Skip to content

Commit 779a986

Browse files
committed
test.cpp: added test to make sure the leak with empty headers no longer occurs
1 parent aabaaab commit 779a986

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3177,6 +3177,16 @@ static void fuzz_crash()
31773177
}
31783178
}
31793179

3180+
static void leak()
3181+
{
3182+
const char code[] = "#include</\\\\>\n"
3183+
"#include</\\\\>\n";
3184+
simplecpp::OutputList outputList;
3185+
ASSERT_EQUALS("", preprocess(code, &outputList));
3186+
ASSERT_EQUALS("file0,1,missing_header,Header not found: </\\\\>\n"
3187+
"file0,2,missing_header,Header not found: </\\\\>\n", toString(outputList));
3188+
}
3189+
31803190
int main(int argc, char **argv)
31813191
{
31823192
TEST_CASE(backslash);
@@ -3436,5 +3446,7 @@ int main(int argc, char **argv)
34363446

34373447
TEST_CASE(fuzz_crash);
34383448

3449+
TEST_CASE(leak);
3450+
34393451
return numberOfFailedAssertions > 0 ? EXIT_FAILURE : EXIT_SUCCESS;
34403452
}

0 commit comments

Comments
 (0)