diff options
Diffstat (limited to 'tests/test/cpp/lex2.scm')
-rw-r--r-- | tests/test/cpp/lex2.scm | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/tests/test/cpp/lex2.scm b/tests/test/cpp/lex2.scm index 0342e25c..762ff176 100644 --- a/tests/test/cpp/lex2.scm +++ b/tests/test/cpp/lex2.scm @@ -6,11 +6,11 @@ (test-equal "Integer literal" - '(preprocessing-token (pp-number "10")) + '((preprocessing-token (pp-number "10"))) (lex "10")) (test-equal "String literal" - '(preprocessing-token (string-literal "Hello")) + '((preprocessing-token (string-literal "Hello"))) (lex "\"Hello\"")) @@ -21,13 +21,13 @@ (lex " 10 ")) (test-equal "Char literal" - '(preprocessing-token (character-constant "a")) + '((preprocessing-token (character-constant "a"))) (lex "'a'")) (test-equal "Comment inside string" - '(preprocessing-token (string-literal "Hel/*lo")) + '((preprocessing-token (string-literal "Hel/*lo"))) (lex "\"Hel/*lo\"")) (test-equal "#define line" @@ -62,3 +62,19 @@ (preprocessing-token (punctuator ")"))) (lex "f(1, (2, 3), 4)")) + + +;; Generating a single lexeme +;; (whitespace " ") +;; would also be ok +(test-equal "Grouped whitespace" + '((whitespace " ") + (whitespace " ")) + (lex " ")) + +(test-equal "Newlines get sepparate whitespace tokens" + '((whitespace " ") + (whitespace " ") + (whitespace "\n") + (whitespace " ")) + (lex " \n ")) |