diff options
Diffstat (limited to '')
-rw-r--r-- | tests/test/cpp/lex2.scm | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/tests/test/cpp/lex2.scm b/tests/test/cpp/lex2.scm index f4f9b857..54bc0aff 100644 --- a/tests/test/cpp/lex2.scm +++ b/tests/test/cpp/lex2.scm @@ -97,35 +97,33 @@ (l '(identifier "dir"))) (lex "..\\listing.dir")) +(test-group "h-strings" -(test-equal "Propper H-string" - (ls '(header-name (h-string "a"))) - (lex "<a>")) + ;; A hstring is the part enclosed by pointy brackets in + ;; #include <header.h> + ;; (e.g. "header.h") + ;; Something with the form <chars> anywhere else should be + ;; treated as (token <) (token chars) (token >) -(test-equal "Unexpected h-string" - (list (l '(pp-number "1")) - (lexeme type: 'whitespace body: " ") - (l '(header-name (h-string " 2 "))) - (lexeme type: 'whitespace body: " ") - (l '(pp-number "3"))) - (lex "1 < 2 > 3")) + (test-equal "Propper H-string" + (list (l '(punctuator "#")) + (l '(identifier "include")) + (lexeme type: 'whitespace body: " ") + (l '(h-string "a"))) + (lex "#include <a>")) -(test-equal "Quotation mark inside h-string" - (ls '(header-name (h-string "a\"b"))) - (lex "<a\"b>")) -(test-equal "Interaction of h-strings and regular strings" - (test-equal "Less than string, not h-string" - (ls '(pp-number "1") - '(string-literal (encoding-prefix) "<") + (test-equal "Not a H string" + (ls '(punctuator "<") + '(identifier "a") '(punctuator ">")) - (lex "1\"<\">")) + (lex "<a>")) - (test-equal "H-string, not string" - (list (lexeme type: 'preprocessing-token body: '(pp-number "1")) - (lexeme type: 'preprocessing-token body: '(header-name (h-string "\""))) - (lexeme type: 'other body: "\"")) - (lex "1<\">\""))) + (test-equal "Quotation mark inside h-string" + (ls '(punctuator "#") + '(identifier "include") + '(h-string "a\"b")) + (lex "#include<a\"b>"))) (test-equal "Q-strings are lexed as regular strings" (list (l '(punctuator "#")) |