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 Feb 17, 2024
1 parent cddd5a2 commit fa994a3
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 @@ -2752,6 +2752,16 @@ static void token()
ASSERT_TOKEN("+22", false, true, false);
}

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 @@ -2984,5 +2994,7 @@ int main(int argc, char **argv)

TEST_CASE(token);

TEST_CASE(leak);

return numberOfFailedAssertions > 0 ? EXIT_FAILURE : EXIT_SUCCESS;
}

0 comments on commit fa994a3

Please sign in to comment.