Skip to content

Commit c213c54

Browse files
committed
add test
1 parent 920637c commit c213c54

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

‎test.cpp‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1967,6 +1967,17 @@ static void error8()
19671967
ASSERT_EQUALS("file0,1,#error,#error blabla\n", toString(outputList));
19681968
}
19691969

1970+
static void error9()
1971+
{
1972+
// #error and #warning in a #define is the stringizing operator, not a directive
1973+
const char code[] = "#define A(error) f(#error); break\n"
1974+
"#define B(warning) g(#warning); x\n"
1975+
"A(e1) B(w1)\n";
1976+
simplecpp::OutputList outputList;
1977+
ASSERT_EQUALS("\n\nf ( \"e1\" ) ; break g ( \"w1\" ) ; x", preprocess(code, &outputList));
1978+
ASSERT_EQUALS("", toString(outputList));
1979+
}
1980+
19701981
static void garbage()
19711982
{
19721983
simplecpp::OutputList outputList;
@@ -6094,6 +6105,7 @@ static void runTests(int argc, char **argv, Input input)
60946105
TEST_CASE(error6);
60956106
TEST_CASE(error7);
60966107
TEST_CASE(error8);
6108+
TEST_CASE(error9);
60976109

60986110
TEST_CASE(garbage);
60996111
TEST_CASE(garbage_endif);

0 commit comments

Comments
 (0)