summaryrefslogtreecommitdiff
path: root/test/test_utf8.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2022-04-29 15:21:27 +0200
committerJörg Frings-Fürst <debian@jff.email>2022-04-29 15:21:27 +0200
commita18b0a88c2af4bc0c371f2e76fb3d75e88f1ff77 (patch)
treec42c12a03537b21e5ec847c489529a0733ba8f6b /test/test_utf8.c
parente179aaa7fd01fa35bb86aab50ff6132bf94533c5 (diff)
parentb221fe9845ea6d4639db16221f6fa8ab2ad11d8e (diff)
Merge branch 'feature/upstream' into develop
Diffstat (limited to 'test/test_utf8.c')
-rw-r--r--test/test_utf8.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/test/test_utf8.c b/test/test_utf8.c
index 9822308..75392e8 100644
--- a/test/test_utf8.c
+++ b/test/test_utf8.c
@@ -1,6 +1,6 @@
/*
* test_utf8.c
- * Copyright (c) 2019-2021 K.Kosako
+ * Copyright (c) 2019-2022 K.Kosako
*/
#ifdef ONIG_ESCAPE_UCHAR_COLLISION
#undef ONIG_ESCAPE_UCHAR_COLLISION
@@ -699,6 +699,8 @@ extern int main(int argc, char* argv[])
x2("(?:(?<x>)|(?<x>efg))\\k<x>", "", 0, 0);
x2("(?:(?<x>abc)|(?<x>efg))\\k<x>", "abcefgefg", 3, 9);
n("(?:(?<x>abc)|(?<x>efg))\\k<x>", "abcefg");
+ x2("(?<x>x)(?<x>xx)\\k<x>", "xxxx", 0, 4);
+ x2("(?<x>x)(?<x>xx)\\k<x>", "xxxxz", 0, 4);
x2("(?:(?<n1>.)|(?<n1>..)|(?<n1>...)|(?<n1>....)|(?<n1>.....)|(?<n1>......)|(?<n1>.......)|(?<n1>........)|(?<n1>.........)|(?<n1>..........)|(?<n1>...........)|(?<n1>............)|(?<n1>.............)|(?<n1>..............))\\k<n1>$", "a-pyumpyum", 2, 10);
x3("(?:(?<n1>.)|(?<n1>..)|(?<n1>...)|(?<n1>....)|(?<n1>.....)|(?<n1>......)|(?<n1>.......)|(?<n1>........)|(?<n1>.........)|(?<n1>..........)|(?<n1>...........)|(?<n1>............)|(?<n1>.............)|(?<n1>..............))\\k<n1>$", "xxxxabcdefghijklmnabcdefghijklmn", 4, 18, 14);
x3("(?<name1>)(?<name2>)(?<name3>)(?<name4>)(?<name5>)(?<name6>)(?<name7>)(?<name8>)(?<name9>)(?<name10>)(?<name11>)(?<name12>)(?<name13>)(?<name14>)(?<name15>)(?<name16>aaa)(?<name17>)$", "aaa", 0, 3, 16);
@@ -1597,6 +1599,37 @@ extern int main(int argc, char* argv[])
x2("[\\W\\x{0063 0071}]+", "*cqa", 0, 3);
x2("(\\O|(?=z\\g<2>*))(\\g<0>){0}", "a", 0, 1);
+ /* whole options */
+ x2("(?Ii)abc", "abc", 0, 3);
+ x2("(?Ii)abc", "ABC", 0, 3);
+ x2("(?Ii:abc)", "abc", 0, 3);
+ x2("(?Ii)xyz|abc", "aBc", 0, 3);
+ x2("(?Ii:zz|abc|AZ)", "ABc", 0, 3);
+ e("(?Ii:abc)d", "abc", ONIGERR_INVALID_GROUP_OPTION);
+ e("(?-Ii:abc)", "abc", ONIGERR_INVALID_GROUP_OPTION);
+ x2("(?I-i:abc)", "abc", 0, 3);
+ e("(?i-I:abc)", "abc", ONIGERR_INVALID_GROUP_OPTION);
+ x2("(?i)\xe2\x84\xaa", "k", 0, 1);
+ n("(?Ii)\xe2\x84\xaa", "k");
+ e("((?Ii)abc)", "", ONIGERR_INVALID_GROUP_OPTION);
+ x2("(?:(?Ii)abc)", "ABC", 0, 3);
+ x2("(?:(?:(?Ii)abc))", "ABC", 0, 3);
+ e("x(?Ii)", "", ONIGERR_INVALID_GROUP_OPTION);
+ e("()(?Ii)", "", ONIGERR_INVALID_GROUP_OPTION);
+ e("(?:)(?Ii)", "", ONIGERR_INVALID_GROUP_OPTION);
+ e("^(?Ii)", "", ONIGERR_INVALID_GROUP_OPTION);
+ e("(?Ii)$", "", ONIGERR_INVALID_GROUP_OPTION);
+ e("(?Ii)|", "", ONIGERR_INVALID_GROUP_OPTION);
+ e("(?Ii)|(?Ii)", "", ONIGERR_INVALID_GROUP_OPTION);
+ x2("a*", "aabcaaa", 0, 2);
+ x2("(?L)a*", "aabcaaa", 4, 7);
+ e("x(?L)xxxxx", "", ONIGERR_INVALID_GROUP_OPTION);
+ e("(?-L)x", "", ONIGERR_INVALID_GROUP_OPTION);
+ x3("(..)\\1", "abab", 0, 2, 1);
+ e("(?C)(..)\\1", "abab", ONIGERR_INVALID_BACKREF);
+ e("(?-C)", "", ONIGERR_INVALID_GROUP_OPTION);
+ e("(?C)(.)(.)(.)(?<name>.)\\1", "abcdd", ONIGERR_NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED);
+
n("a(b|)+d", "abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcd"); /* https://www.haijin-boys.com/discussions/5079 */
n(" \xfd", ""); /* https://bugs.php.net/bug.php?id=77370 */
/* can't use \xfc00.. because compiler error: hex escape sequence out of range */