Skip to content

Commit 8a9eb08

Browse files
committed
test.cpp: added test to make sure the leak with empty headers no longer occurs
1 parent 85704d6 commit 8a9eb08

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
@@ -3221,6 +3221,16 @@ static void fuzz_crash()
32213221
}
32223222
}
32233223

3224+
static void leak()
3225+
{
3226+
const char code[] = "#include</\\\\>\n"
3227+
"#include</\\\\>\n";
3228+
simplecpp::OutputList outputList;
3229+
ASSERT_EQUALS("", preprocess(code, &outputList));
3230+
ASSERT_EQUALS("file0,1,missing_header,Header not found: </\\\\>\n"
3231+
"file0,2,missing_header,Header not found: </\\\\>\n", toString(outputList));
3232+
}
3233+
32243234
int main(int argc, char **argv)
32253235
{
32263236
TEST_CASE(backslash);
@@ -3481,5 +3491,7 @@ int main(int argc, char **argv)
34813491

34823492
TEST_CASE(fuzz_crash);
34833493

3494+
TEST_CASE(leak);
3495+
34843496
return numberOfFailedAssertions > 0 ? EXIT_FAILURE : EXIT_SUCCESS;
34853497
}

0 commit comments

Comments
 (0)