Add integration test using negated class

This commit is contained in:
Camden Dixie O'Brien 2024-11-03 11:54:34 +00:00
parent 3c89cc4e99
commit 892ff89a66

View File

@ -74,6 +74,19 @@ static void test_system_header_include_regex(void)
fsa_free(&dfa); fsa_free(&dfa);
} }
static void test_quoted_string_regex(void)
{
fsa_t dfa;
const char *regex = "'(\\\\'|[^'])*'";
const bool success = compile(regex, strlen(regex), &dfa);
ASSERT_TRUE(success);
ASSERT_ACCEPTS(&dfa, "''");
ASSERT_ACCEPTS(&dfa, "'foo bar baz'");
ASSERT_ACCEPTS(&dfa, "'foo \\'bar\\' baz'");
ASSERT_REJECTS(&dfa, "'foo 'bar' baz'");
fsa_free(&dfa);
}
int main(void) int main(void)
{ {
TESTING_BEGIN(); TESTING_BEGIN();
@ -82,5 +95,6 @@ int main(void)
test_arbitrary_regex_1(); test_arbitrary_regex_1();
test_arbitrary_regex_2(); test_arbitrary_regex_2();
test_system_header_include_regex(); test_system_header_include_regex();
test_quoted_string_regex();
return TESTING_END(); return TESTING_END();
} }