Skip to content

Commit fa994a3

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

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
@@ -2752,6 +2752,16 @@ static void token()
27522752
ASSERT_TOKEN("+22", false, true, false);
27532753
}
27542754

2755+
static void leak()
2756+
{
2757+
const char code[] = "#include</\\\\>\n"
2758+
"#include</\\\\>\n";
2759+
simplecpp::OutputList outputList;
2760+
ASSERT_EQUALS("", preprocess(code, &outputList));
2761+
ASSERT_EQUALS("file0,1,missing_header,Header not found: </\\\\>\n"
2762+
"file0,2,missing_header,Header not found: </\\\\>\n", toString(outputList));
2763+
}
2764+
27552765
int main(int argc, char **argv)
27562766
{
27572767
TEST_CASE(backslash);
@@ -2984,5 +2994,7 @@ int main(int argc, char **argv)
29842994

29852995
TEST_CASE(token);
29862996

2997+
TEST_CASE(leak);
2998+
29872999
return numberOfFailedAssertions > 0 ? EXIT_FAILURE : EXIT_SUCCESS;
29883000
}

0 commit comments

Comments
 (0)