aboutsummaryrefslogtreecommitdiff
path: root/tests/test/cpp/preprocessor2.scm
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test/cpp/preprocessor2.scm')
-rw-r--r--tests/test/cpp/preprocessor2.scm39
1 files changed, 31 insertions, 8 deletions
diff --git a/tests/test/cpp/preprocessor2.scm b/tests/test/cpp/preprocessor2.scm
index 9b71e1ca..5e1bb736 100644
--- a/tests/test/cpp/preprocessor2.scm
+++ b/tests/test/cpp/preprocessor2.scm
@@ -769,16 +769,39 @@ X
(test-group "Pragma"
(test-group "#pragma"
(test-equal "#Pragma STDC FP_CONTRACT ON"
- (with-output-to-string (lambda () (run "#pragma STDC FP_CONTRACT ON"))))
+ (with-output-to-string (lambda () (run "#pragma STDC FP_CONTRACT ON")))))
- )
(test-group "_Pragma"
- (test-equal "#Pragma STDC FP_CONTRACT ON"
- (with-output-to-string
- (lambda () (run "_Pragma(\"STDC FP_CONTRACT ON\")"
- (extend-environment (make-environment)
- (list
- (@ (c preprocessor2) _Pragma-macro)))))))))
+ (let ((e (extend-environment (make-environment)
+ (list
+ (@ (c preprocessor2) _Pragma-macro)))))
+ (test-equal "#Pragma STDC FP_CONTRACT ON"
+ (with-output-to-string
+ (lambda () (run "_Pragma(\"STDC FP_CONTRACT ON\")" e))))
+
+ ;; 6.10.9 example
+ (test-group "Non-standard #Pragma: listing on \"..\\\\listing.dir\""
+ ;; source: LISTING( ..\listing.dir )
+ ;; dest: _Pragma( "listing on \"..\\listing.dir\"")
+
+ (test-equal "Dry-run"
+ "pragma(\"listing on \\\"..\\\\\\\\listing.dir\\\"\")"
+ (unlex (run "
+#define LISTING(x) PRAGMA(listing on #x)
+#define PRAGMA(x) pragma(#x)
+LISTING(..\\listing.dir)"))
+ )
+
+ (test-equal "With _Pragma"
+ "Non-standard #Pragma: listing on \"..\\\\listing.dir\""
+ (with-output-to-string
+ (lambda ()
+ (run "
+#define LISTING(x) PRAGMA(listing on #x)
+#define PRAGMA(x) _Pragma(#x)
+LISTING(..\\listing.dir)
+" e))))))
+ ))
;; TODO
;; if