From 0b4d4b0e4171ba170c0468fdcc014bcd16232802 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Fri, 15 Jul 2022 02:48:00 +0200 Subject: Fix nested #if --- tests/test/cpp/preprocessor2.scm | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'tests/test') diff --git a/tests/test/cpp/preprocessor2.scm b/tests/test/cpp/preprocessor2.scm index 71e0c1a0..27332894 100644 --- a/tests/test/cpp/preprocessor2.scm +++ b/tests/test/cpp/preprocessor2.scm @@ -641,8 +641,6 @@ (lex "\"stdio.h\"")))) ;; TODO #include is subject to macro expansion - ;; test with through resolve-header - (test-group "Actually including stuff" (call-with-tmp-header " @@ -1135,8 +1133,30 @@ _Pragma(\"not-called\") #endif")))) - (test-group "Nested conditions" - 'TODO) + (test-equal "Nested conditions" + (lex "a\n\nc") + (run " +#define X +#ifdef X +a +#ifdef Y +b +#endif +c +#endif +")) + + (test-equal + (lex "") + (run " +#ifdef X +a +#ifdef Y +b +#endif /* Y */ +c +#endif /* X */ +")) (test-group "Unexpected if ends" (test-error "#else outside if" -- cgit v1.2.3