aboutsummaryrefslogtreecommitdiff
path: root/tests/test/cpp/preprocessor2.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-07-10 23:51:25 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2022-07-10 23:53:01 +0200
commitbc8768984e07c567337a899b861c009fb7cc9ce7 (patch)
tree69e35cff23185bc5c44003b5974f804c7510cd01 /tests/test/cpp/preprocessor2.scm
parentResolve recursive macros. (diff)
downloadcalp-bc8768984e07c567337a899b861c009fb7cc9ce7.tar.gz
calp-bc8768984e07c567337a899b861c009fb7cc9ce7.tar.xz
Fix #line
Diffstat (limited to 'tests/test/cpp/preprocessor2.scm')
-rw-r--r--tests/test/cpp/preprocessor2.scm20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/test/cpp/preprocessor2.scm b/tests/test/cpp/preprocessor2.scm
index e2ff0a17..9e11bb04 100644
--- a/tests/test/cpp/preprocessor2.scm
+++ b/tests/test/cpp/preprocessor2.scm
@@ -545,6 +545,26 @@ f(10)
+(define cpp-file-stack (@@ (c cpp-environment) cpp-file-stack))
+(define handle-line-directive (@@ (c preprocessor2) handle-line-directive))
+
+(test-group "Line directive"
+ (let ((e (make-environment)))
+ (test-equal "#line <number>"
+ '(("*outside*" . 10))
+ (cpp-file-stack (handle-line-directive e (lex "10"))))
+ (test-equal "#line <line> <file>"
+ '(("file" . 10))
+ (cpp-file-stack (handle-line-directive e (lex "10 \"file\""))))
+
+ (test-equal "#line <macro>"
+ '(("*outside*" . 10))
+ (cpp-file-stack
+ (handle-line-directive
+ (resolve-define e (lex "x 10"))
+ (lex "x"))))))
+
+
;; resolve-h-file
;; resolve-q-file
;; handle-pragma