From 997f33a4973091569d487363419704f38b3d6c65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Wed, 13 Jul 2022 11:36:17 +0200 Subject: Fix _Pragma, and non-standard pragma directives. --- tests/test/cpp/preprocessor2.scm | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) (limited to 'tests') 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 -- cgit v1.2.3