diff options
Diffstat (limited to '')
-rw-r--r-- | tests/test/cpp.scm | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/tests/test/cpp.scm b/tests/test/cpp.scm index 32072932..fa767fe3 100644 --- a/tests/test/cpp.scm +++ b/tests/test/cpp.scm @@ -514,23 +514,38 @@ (test-group "String with only escape" (let ((form (string #\" #\\ #\" #\"))) - (test-equal `(string "\"") (lex form)) + (test-equal `(string (escaped-char "\"")) (lex form)) (test-equal #vu8(34 0) (run form)))) (test-group "String with escape at start" (let ((form (string #\" #\\ #\" #\a #\"))) - (test-equal `(string "\"a") (lex form)) + (test-equal `(string (escaped-char "\"") "a") (lex form)) (test-equal #vu8(34 #x61 0) (run form)))) (test-group "String with escape at end" (let ((form (string #\" #\a #\\ #\" #\"))) - (test-equal `(string "a\"") (lex form)) + (test-equal `(string "a" (escaped-char "\"")) (lex form)) (test-equal #vu8(#x61 34 0) (run form)))) (test-group "String with escape in middle" (let ((form (string #\" #\a #\\ #\" #\b #\"))) - (test-equal `(string "a\"b") (lex form)) - (test-equal #vu8(#x61 34 #x62 0) (run form))))) + (test-equal `(string "a" (escaped-char "\"") "b") (lex form)) + (test-equal #vu8(#x61 34 #x62 0) (run form)))) + + ;; \e is semi non-standard + (test-group "String with bakslash-e esacpe" + (let ((form "\"\\e\"")) + (test-equal '(string (escaped-char "e")) (lex form)) + (test-equal #vu8(#x1b 0) (run form)))) + + (test-group "String with byte secquence escape" + (let ((form "\"\\xf0\\x9f\\x92\\xa9\"")) + (test-equal '(string (escaped-char (base-16-char "f0")) + (escaped-char (base-16-char "9f")) + (escaped-char (base-16-char "92")) + (escaped-char (base-16-char "a9"))) + (lex form)) + (test-equal #vu8(#xf0 #x9f #x92 #xa9 0) (run form))))) (test-group "__asm__" (let ((form "__asm__(\".globl \" __XSTRING(sym))")) |