diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2023-12-19 08:12:44 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2023-12-19 08:12:44 +0100 |
commit | 7547c5a1405dff1aac1ab054a24907b3ae724c12 (patch) | |
tree | 4ca475fcd4511e8cd245ce31349f4efb56089aaf /test/test_syntax.c | |
parent | 9d10df3f441724d605cd8729c8e8d3ba1ad816f4 (diff) | |
parent | e87df9b5e9eea77d2155767952c996f91b5eebfc (diff) |
Merge branch 'release/debian/6.9.9-1'HEADdebian/6.9.9-1master
Diffstat (limited to 'test/test_syntax.c')
-rw-r--r-- | test/test_syntax.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/test/test_syntax.c b/test/test_syntax.c index b501ccd..b07fe67 100644 --- a/test/test_syntax.c +++ b/test/test_syntax.c @@ -259,6 +259,30 @@ static int test_python_single_multi() return 0; } +static int test_BRE_anchors() +{ + x2("a\\^b", "a^b", 0, 3); + x2("a^b", "a^b", 0, 3); + x2("a\\$b", "a$b", 0, 3); + x2("a$b", "a$b", 0, 3); + + x2("^ab", "ab", 0, 2); + x2("(^ab)", "(^ab)", 0, 5); + x2("\\(^ab\\)", "ab", 0, 2); + x2("\\\\(^ab\\\\)", "\\(^ab\\)", 0, 7); + n("\\\\\\(^ab\\\\\\)", "\\ab\\"); + x2("^\\\\\\(ab\\\\\\)", "\\ab\\", 0, 4); + + x2("ab$", "ab", 0, 2); + x2("(ab$)", "(ab$)", 0, 5); + x2("\\(ab$\\)", "ab", 0, 2); + x2("\\\\(ab$\\\\)", "\\(ab$\\)", 0, 7); + n("\\\\\\(ab$\\\\\\)", "\\ab\\"); + x2("\\\\\\(ab\\\\\\)$", "\\ab\\", 0, 4); + + return 0; +} + extern int main(int argc, char* argv[]) { OnigEncoding use_encs[1]; @@ -309,6 +333,26 @@ extern int main(int argc, char* argv[]) x2("\\U00000041", "A", 0, 1); e("\\U0041", "A", ONIGERR_INVALID_CODE_POINT_VALUE); + Syntax = ONIG_SYNTAX_POSIX_BASIC; + test_BRE_anchors(); + + Syntax = ONIG_SYNTAX_GREP; + test_BRE_anchors(); + x2("zz\\|^ab", "ab", 0, 2); + x2("ab$\\|zz", "ab", 0, 2); + + Syntax = ONIG_SYNTAX_PERL_NG; + + x2("(?i)test", "test", 0, 4); + x2("(?-i)test", "test", 0, 4); + x2("(?i)test", "TEST", 0, 4); + n("(?-i)test", "teSt"); + x2("(?i)te(?-i)st", "TEst", 0, 4); + n("(?i)te(?-i)st", "TesT"); + + x2("(abc)(?-1)", "abcabc", 0, 6); + x2("(?+1)(abc)", "abcabc", 0, 6); + x2("(abc)(?1)", "abcabc", 0, 6); fprintf(stdout, "\nRESULT SUCC: %4d, FAIL: %d, ERROR: %d (by Oniguruma %s)\n", |