aboutsummaryrefslogtreecommitdiff
path: root/tests/test/cpp/lex2.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-07-07 18:40:27 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2022-07-07 21:31:32 +0200
commit1393ce3878e5d14214631fb83d58c819a7849b18 (patch)
treed1e34b2b459ea9c1702ac72f6e66f0b05ce45223 /tests/test/cpp/lex2.scm
parentChange makefile to explicit list of files. (diff)
downloadcalp-1393ce3878e5d14214631fb83d58c819a7849b18.tar.gz
calp-1393ce3878e5d14214631fb83d58c819a7849b18.tar.xz
work.
Diffstat (limited to 'tests/test/cpp/lex2.scm')
-rw-r--r--tests/test/cpp/lex2.scm24
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 "))