summaryrefslogtreecommitdiff
path: root/test/test_utf8.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2023-11-20 20:10:50 +0100
committerJörg Frings-Fürst <debian@jff.email>2023-11-20 20:10:50 +0100
commit35e13e4c9637f5bf7bef6039c8c813207780a174 (patch)
treef2ea0b1aa455bb2552ffe8a7bb083f24e86d1f34 /test/test_utf8.c
parentdb6f38bc1b73930f1da954525464cf1986f43a28 (diff)
New upstream version 6.9.9upstream/6.9.9upstream
Diffstat (limited to 'test/test_utf8.c')
-rw-r--r--test/test_utf8.c86
1 files changed, 86 insertions, 0 deletions
diff --git a/test/test_utf8.c b/test/test_utf8.c
index 75392e8..77149d7 100644
--- a/test/test_utf8.c
+++ b/test/test_utf8.c
@@ -226,6 +226,27 @@ extern int main(int argc, char* argv[])
x2("[*[:xdigit:]+]", "-@^+", 3, 4);
n("[[:upper]]", "A");
x2("[[:upper]]", ":", 0, 1);
+ n("[[:upper:]]", "a");
+ x2("[[:^upper:]]", "a", 0, 1);
+ n("[[:lower:]]", "A");
+ x2("[[:^lower:]]", "A", 0, 1);
+
+ // Issue #253
+ e("[[:::]", ":[", ONIGERR_PREMATURE_END_OF_CHAR_CLASS);
+ e("[[:\\]:]", ":]", ONIGERR_PREMATURE_END_OF_CHAR_CLASS);
+ e("[[:\\[:]", ":[", ONIGERR_PREMATURE_END_OF_CHAR_CLASS);
+ e("[[:\\]]", ":]", ONIGERR_PREMATURE_END_OF_CHAR_CLASS);
+ e("[[:u:]]", "", ONIGERR_INVALID_POSIX_BRACKET_TYPE);
+ e("[[:upp:]]", "", ONIGERR_INVALID_POSIX_BRACKET_TYPE);
+ e("[[:uppers:]]", "", ONIGERR_INVALID_POSIX_BRACKET_TYPE);
+ x2("[[:upper\\] :]]", "]", 0, 1);
+
+ x2("[[::]]", ":", 0, 1);
+ x2("[[:::]]", ":", 0, 1);
+ x2("[[:\\]:]]*", ":]", 0, 2);
+ x2("[[:\\[:]]*", ":[", 0, 2);
+ x2("[[:\\]]]*", ":]", 0, 2);
+
x2("[\\044-\\047]", "\046", 0, 1);
x2("[\\x5a-\\x5c]", "\x5b", 0, 1);
x2("[\\x6A-\\x6D]", "\x6c", 0, 1);
@@ -1623,6 +1644,8 @@ extern int main(int argc, char* argv[])
e("(?Ii)|(?Ii)", "", ONIGERR_INVALID_GROUP_OPTION);
x2("a*", "aabcaaa", 0, 2);
x2("(?L)a*", "aabcaaa", 4, 7);
+ x2("(?L)a{4}|a{3}|b*", "baaaaabbb", 1, 5);
+ x2("(?L)a{3}|a{4}|b*", "baaaaabbb", 1, 5);
e("x(?L)xxxxx", "", ONIGERR_INVALID_GROUP_OPTION);
e("(?-L)x", "", ONIGERR_INVALID_GROUP_OPTION);
x3("(..)\\1", "abab", 0, 2, 1);
@@ -1630,6 +1653,69 @@ extern int main(int argc, char* argv[])
e("(?-C)", "", ONIGERR_INVALID_GROUP_OPTION);
e("(?C)(.)(.)(.)(?<name>.)\\1", "abcdd", ONIGERR_NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED);
+ // Issue #264
+ n("(?iI)s", "\xc5\xbf");
+ n("(?iI)[s]", "\xc5\xbf"); // FAIL
+ n("(?iI:s)", "\xc5\xbf");
+ n("(?iI:[s])", "\xc5\xbf"); // FAIL
+ x2("(?iI)(?:[[:word:]])", "\xc5\xbf", 0, 2);
+ n("(?iI)(?W:[[:word:]])", "\xc5\xbf"); // FAIL
+ n("(?iI)(?W:\\w)", "\xc5\xbf");
+ n("(?iI)(?W:[\\w])", "\xc5\xbf"); // FAIL
+ n("(?iI)(?W:\\p{Word})", "\xc5\xbf");
+ n("(?iI)(?W:[\\p{Word}])", "\xc5\xbf"); // FAIL
+
+ x2("(?iW:[[:word:]])", "\xc5\xbf", 0, 2);
+ x2("(?iW:[\\p{Word}])", "\xc5\xbf", 0, 2);
+ x2("(?iW:[\\w])", "\xc5\xbf", 0, 2);
+ n("(?iW:\\p{Word})", "\xc5\xbf");
+ n("(?iW:\\w)", "\xc5\xbf");
+ x2("(?i)\\p{Word}", "\xc5\xbf", 0, 2);
+ x2("(?i)\\w", "\xc5\xbf", 0, 2);
+
+ x2("(?iW:[[:^word:]])", "\xc5\xbf", 0, 2);
+ x2("(?iW:[\\P{Word}])", "\xc5\xbf", 0, 2);
+ x2("(?iW:[\\W])", "\xc5\xbf", 0, 2);
+ x2("(?iW:\\P{Word})", "\xc5\xbf", 0, 2);
+ x2("(?iW:\\W)", "\xc5\xbf", 0, 2);
+ n("(?i)\\P{Word}", "\xc5\xbf");
+ n("(?i)\\W", "\xc5\xbf");
+
+ x2("(?iW:[[:^word:]])", "s", 0, 1);
+ x2("(?iW:[\\P{Word}])", "s", 0, 1);
+ x2("(?iW:[\\W])", "s", 0, 1);
+ n("(?iW:\\P{Word})", "s");
+ n("(?iW:\\W)", "s");
+ n("(?i)\\P{Word}", "s");
+ n("(?i)\\W", "s");
+
+ x2("[[:punct:]]", ":", 0, 1);
+ x2("[[:punct:]]", "$", 0, 1);
+ x2("[[:punct:]]+", "$+<=>^`|~", 0, 9);
+ n("[[:punct:]]", "a");
+ n("[[:punct:]]", "7");
+ x2("\\p{PosixPunct}+", "$¦", 0, 3);
+
+ x2("\\A.*\\R", "\n", 0, 1);
+ x2("\\A\\O*\\R", "\n", 0, 1);
+ x2("\\A\\n*\\R", "\n", 0, 1);
+ x2("\\A\\R*\\R", "\n", 0, 1);
+ x2("\\At*\\R", "\n", 0, 1);
+
+ x2("\\A.{0,99}\\R", "\n", 0, 1);
+ x2("\\A\\O{0,99}\\R", "\n", 0, 1);
+ x2("\\A\\n{0,99}\\R", "\n", 0, 1);
+ x2("\\A\\R{0,99}\\R", "\n", 0, 1);
+ x2("\\At{0,99}\\R", "\n", 0, 1);
+
+ x2("\\A.*\\n", "\n", 0, 1); // \n
+ x2("\\A.{0,99}\\n", "\n", 0, 1);
+ x2("\\A.*\\O", "\n", 0, 1); // \O
+ x2("\\A.{0,99}\\O", "\n", 0, 1);
+ x2("\\A.*\\s", "\n", 0, 1); // \s
+ x2("\\A.{0,99}\\s", "\n", 0, 1);
+
+
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 */