You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ASSERT_EQUALS("file0,1,syntax_error,Failed to parse #define, bad macro syntax\n", toString(outputList));
917
927
}
918
928
929
+
staticvoiddefine_invalid_3()
930
+
{
931
+
constchar code[] = "#define R()\n"
932
+
"R";
933
+
simplecpp::OutputList outputList;
934
+
ASSERT_EQUALS("", preprocess(code, &outputList));
935
+
ASSERT_EQUALS("file0,2,syntax_error,failed to expand 'R', Wrong number of parameters for macro 'R'.\n", toString(outputList));
936
+
}
937
+
938
+
staticvoiddefine_invalid_4()
939
+
{
940
+
constchar code[] = "#define X(...)\n"
941
+
"X";
942
+
simplecpp::OutputList outputList;
943
+
ASSERT_EQUALS("", preprocess(code, &outputList));
944
+
ASSERT_EQUALS("file0,2,syntax_error,failed to expand 'X', Wrong number of parameters for macro 'X'.\n", toString(outputList));
945
+
}
946
+
919
947
staticvoiddefine_define_1()
920
948
{
921
949
constchar code[] = "#define A(x) (x+1)\n"
@@ -1345,6 +1373,30 @@ static void define_ifdef()
1345
1373
1346
1374
}
1347
1375
1376
+
staticvoidif_invalid_1()
1377
+
{
1378
+
constchar code[] = "#if'\\u'";
1379
+
simplecpp::OutputList outputList;
1380
+
ASSERT_EQUALS("", preprocess(code, &outputList));
1381
+
ASSERT_EQUALS("file0,1,syntax_error,failed to evaluate #if condition, expected digit\n", toString(outputList));
1382
+
}
1383
+
1384
+
staticvoidif_invalid_2()
1385
+
{
1386
+
constchar code[] = "#if-0xBBB4444444444444%~B";
1387
+
simplecpp::OutputList outputList;
1388
+
ASSERT_EQUALS("", preprocess(code, &outputList));
1389
+
ASSERT_EQUALS("file0,1,syntax_error,failed to evaluate #if condition, division overflow\n", toString(outputList));
1390
+
}
1391
+
1392
+
staticvoidif_invalid_3()
1393
+
{
1394
+
constchar code[] = "#if@u'\\udefa'";
1395
+
simplecpp::OutputList outputList;
1396
+
ASSERT_EQUALS("", preprocess(code, &outputList));
1397
+
ASSERT_EQUALS("file0,1,syntax_error,failed to evaluate #if condition, surrogate code points not allowed in universal character names\n", toString(outputList));
0 commit comments