Skip to content

Commit

Permalink
test.cpp: added test to make sure the leak with empty headers no long…
Browse files Browse the repository at this point in the history
…er occurs
  • Loading branch information
firewave committed May 24, 2024
1 parent 5d1ffcd commit 5bacce1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2844,6 +2844,16 @@ static void fuzz_crash()
}
}

static void leak()
{
const char code[] = "#include</\\\\>\n"
"#include</\\\\>\n";
simplecpp::OutputList outputList;
ASSERT_EQUALS("", preprocess(code, &outputList));
ASSERT_EQUALS("file0,1,missing_header,Header not found: </\\\\>\n"
"file0,2,missing_header,Header not found: </\\\\>\n", toString(outputList));
}

int main(int argc, char **argv)
{
TEST_CASE(backslash);
Expand Down Expand Up @@ -3081,5 +3091,7 @@ int main(int argc, char **argv)

TEST_CASE(fuzz_crash);

TEST_CASE(leak);

return numberOfFailedAssertions > 0 ? EXIT_FAILURE : EXIT_SUCCESS;
}

0 comments on commit 5bacce1

Please sign in to comment.