From 1393ce3878e5d14214631fb83d58c819a7849b18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Thu, 7 Jul 2022 18:40:27 +0200 Subject: work. --- tests/test/cpp/lex2.scm | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'tests/test/cpp/lex2.scm') 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 ")) -- cgit v1.2.3