diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-07-11 19:48:47 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-07-11 19:48:47 +0200 |
commit | f743e08220883eef86effdac8a5e7c94deddc302 (patch) | |
tree | 053da1a51b7262721e1fcb1324994122ce427bc6 /tests/test/cpp/preprocessor2.scm | |
parent | Fix whitespace for rest args. (diff) | |
download | calp-f743e08220883eef86effdac8a5e7c94deddc302.tar.gz calp-f743e08220883eef86effdac8a5e7c94deddc302.tar.xz |
Cleanup + fix __LINE__.
Diffstat (limited to 'tests/test/cpp/preprocessor2.scm')
-rw-r--r-- | tests/test/cpp/preprocessor2.scm | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/tests/test/cpp/preprocessor2.scm b/tests/test/cpp/preprocessor2.scm index 9ad1a726..b5e9e001 100644 --- a/tests/test/cpp/preprocessor2.scm +++ b/tests/test/cpp/preprocessor2.scm @@ -14,10 +14,6 @@ :use-module (c lex2)) -(test-skip "__LINE__ through macro") -(test-skip "__LINE__ standalone") - - ;; arbitrary tokens useful in tests for checking that values are returned correctly (define before (car (lex "before"))) (define after (car (lex "after"))) @@ -599,36 +595,45 @@ f(10) (handle-preprocessing-tokens (make-environment) (lex "1"))) +(define (run str) + (remove-noexpand + (handle-preprocessing-tokens + (make-environment) + (tokenize str)))) + + (test-equal "Define" (lex "1") - (remove-noexpand - (handle-preprocessing-tokens (make-environment) - (lex " + (run " #define x 1 -x")))) +x")) + +(test-equal "only __LINE__" + (lex "1") + (run "__LINE__")) + +(test-equal "__LINE__ after linebreak" + (lex "2") + (run "\n__LINE__")) + (test-equal "__LINE__ through macro" (lex "5") - (drop-whitespace-both - (remove-noexpand - (handle-preprocessing-tokens (make-environment) - (tokenize " // 1 + (drop-whitespace-both (run " // 1 #define x __LINE__ // 2 // 3 // 4 x // 5")) - ))) + ) (test-equal "__LINE__ standalone" (lex "5") (drop-whitespace-both - (remove-noexpand - (handle-preprocessing-tokens (make-environment) - (tokenize " // 1 + (run " // 1 // 2 // 3 // 4 -__LINE__"))))) +__LINE__"))) @@ -641,11 +646,6 @@ __LINE__"))))) (test-equal (lex "ab") (expand## (lex "a ## b"))) ) -(define (run str) - (remove-noexpand - (handle-preprocessing-tokens - (make-environment) - (tokenize str)))) (test-equal "Token concatenation in function like macro" |