Fix allocation issue in FSA module

This commit is contained in:
2024-11-02 23:15:15 +00:00
parent 232295fff4
commit d6d5951b95
2 changed files with 16 additions and 2 deletions

View File

@@ -63,6 +63,17 @@ static void test_arbitrary_regex_2(void)
fsa_free(&dfa);
}
static void test_system_header_include_regex(void)
{
fsa_t dfa;
const char *regex = "#include <[abcdefghijklmnopqrstuvwxyz]+\\.h>";
const bool success = compile(regex, strlen(regex), &dfa);
ASSERT_TRUE(success);
ASSERT_ACCEPTS(&dfa, "#include <stdio.h>");
ASSERT_REJECTS(&dfa, "#include \"foo.h\"");
fsa_free(&dfa);
}
int main(void)
{
TESTING_BEGIN();
@@ -70,5 +81,6 @@ int main(void)
test_even_number_of_Is_regex();
test_arbitrary_regex_1();
test_arbitrary_regex_2();
test_system_header_include_regex();
return TESTING_END();
}