aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorK.Kosako <kkosako0@gmail.com>2024-06-05 22:44:21 +0900
committerK.Kosako <kkosako0@gmail.com>2024-06-05 22:44:21 +0900
commitf2f9c695e0ec4584f14e5df29c7df6e8ff38862a (patch)
treef2da08293423f5a2a76773d4f8a93faff4671d1d
parent2c747f537fbf2d44d5fab7f93c4b4ece9a4c883e (diff)
downloadoniguruma-f2f9c695e0ec4584f14e5df29c7df6e8ff38862a.zip
oniguruma-f2f9c695e0ec4584f14e5df29c7df6e8ff38862a.tar.gz
oniguruma-f2f9c695e0ec4584f14e5df29c7df6e8ff38862a.tar.bz2
add some test cases for #298
-rw-r--r--test/test_syntax.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/test_syntax.c b/test/test_syntax.c
index 603fd00..2ac3826 100644
--- a/test/test_syntax.c
+++ b/test/test_syntax.c
@@ -223,6 +223,20 @@ static int test_look_behind()
return 0;
}
+static int test_char_class()
+{
+ x2("[\\w\\-%]", "a", 0, 1);
+ x2("[\\w\\-%]", "%", 0, 1);
+ x2("[\\w\\-%]", "-", 0, 1);
+
+ //e("[\\w-%]", "-", ONIGERR_UNMATCHED_RANGE_SPECIFIER_IN_CHAR_CLASS);
+ x2("[\\w-%]", "a", 0, 1);
+ x2("[\\w-%]", "%", 0, 1);
+ x2("[\\w-%]", "-", 0, 1);
+
+ return 0;
+}
+
static int test_python_option_ascii()
{
x2("(?a)\\w", "a", 0, 1);
@@ -311,6 +325,7 @@ extern int main(int argc, char* argv[])
test_isolated_option();
test_prec_read();
test_look_behind();
+ test_char_class();
e("(?<=ab|(.))\\1", "abb", ONIGERR_INVALID_LOOK_BEHIND_PATTERN); // Variable length lookbehind not implemented in Perl 5.26.1
x3("()", "abc", 0, 0, 1);
@@ -325,6 +340,7 @@ extern int main(int argc, char* argv[])
test_isolated_option();
test_prec_read();
test_look_behind();
+ test_char_class();
x2("(?<=ab|(.))\\1", "abb", 2, 3);
n("(?<!ab|b)c", "bbc");
n("(?<!b|ab)c", "bbc");