From bc8768984e07c567337a899b861c009fb7cc9ce7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sun, 10 Jul 2022 23:51:25 +0200 Subject: Fix #line --- tests/test/cpp/preprocessor2.scm | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'tests/test/cpp/preprocessor2.scm') 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 " + '(("*outside*" . 10)) + (cpp-file-stack (handle-line-directive e (lex "10")))) + (test-equal "#line " + '(("file" . 10)) + (cpp-file-stack (handle-line-directive e (lex "10 \"file\"")))) + + (test-equal "#line " + '(("*outside*" . 10)) + (cpp-file-stack + (handle-line-directive + (resolve-define e (lex "x 10")) + (lex "x")))))) + + ;; resolve-h-file ;; resolve-q-file ;; handle-pragma -- cgit v1.2.3