<<
path:
root/public/blog.git/html/modules/uniform/tests/100_compile.spec.jai
blob: 12aef0f804ed7ecff73ef6a50451b81a67a41bcf
[raw]
[clear marker]
0simplifies_a_parsed_regexp_without_error_params :: Stringify_Test_Args.[
6 .{"[ac]{2}", "[ac][ac]"},
7 .{"[abc]{2}", "[a-c][a-c]"},
8 .{"[ac]{2,}", "[ac][ac]+"},
9 .{"[ac]{2,4}", "[ac][ac](?:[ac][ac]?)?"},
10 .{"a[bc]{2}d", "a[b-c][b-c]d"},
11 .{"ab?(cd)+", "ab?(cd)+"},
12 .{"ab?(cd)+a*(:?foo)?", "ab?(cd)+a*(:?foo)?"},
16simplifies_a_parsed_regexp_without_error :: (args: Stringify_Test_Args) {
17 parsed, status, pool := parse(args.pattern);
20 result := simplify(parsed, *pool);
22 assert_that(result, is_not(null));
23 stringified := to_string(result);
24 defer free(stringified);
25 assert_that(stringified, is(args.expected_string));
28compiles_a_parsed_regexp_without_error_params :: string.[
41 "[^a]", // This range contains both single-byte and multi-byte utf-8 characters
46compiles_a_parsed_regexp_without_error :: (re_string: string) {
47 parsed, status, pool := parse(re_string);
50 re := compile(parsed, *pool);
52 assert_that(re, is_not(null));
57Stringify_Test_Args :: struct {
59 expected_string: string;