aboutsummaryrefslogtreecommitdiff
path: root/tests/test/cpp/lex2.scm
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test/cpp/lex2.scm')
-rw-r--r--tests/test/cpp/lex2.scm23
1 files changed, 21 insertions, 2 deletions
diff --git a/tests/test/cpp/lex2.scm b/tests/test/cpp/lex2.scm
index 54bc0aff..e30aac31 100644
--- a/tests/test/cpp/lex2.scm
+++ b/tests/test/cpp/lex2.scm
@@ -9,6 +9,9 @@
(define (ls . xs)
(map l xs))
+;; See comment on h-string-compound in (c lex2)
+(test-expect-fail "H-string looking as argument to macro")
+
(test-equal "Integer literal"
(ls '(pp-number "10"))
(lex "10"))
@@ -108,17 +111,33 @@
(test-equal "Propper H-string"
(list (l '(punctuator "#"))
(l '(identifier "include"))
- (lexeme type: 'whitespace body: " ")
+ ;; (lexeme type: 'whitespace body: " ")
(l '(h-string "a")))
(lex "#include <a>"))
-
(test-equal "Not a H string"
(ls '(punctuator "<")
'(identifier "a")
'(punctuator ">"))
(lex "<a>"))
+ ;; Assume that s is defined as
+ ;; #define s(x) #x
+ ;; then the following expression would expand to
+ ;; "#include<a>"
+ (test-equal "H-string looking as argument to macro"
+ (ls '(identifier "s")
+ '(punctuator "(")
+ '(punctuator "#")
+ '(identifier "include")
+ '(punctuator "<")
+ '(identifier "a")
+ '(punctuator ">")
+ '(punctuator ")"))
+ (lex "s(#include<a>)"))
+
+ ;; The standard says this case is undefined
+ ;; 6.4.7 p. 3
(test-equal "Quotation mark inside h-string"
(ls '(punctuator "#")
'(identifier "include")