diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/CMakeLists.txt | 55 | ||||
-rwxr-xr-x | test/test.sh | 17 | ||||
-rw-r--r-- | test/test_back.c | 6 | ||||
-rw-r--r-- | test/test_options.c | 10 | ||||
-rw-r--r-- | test/test_syntax.c | 100 | ||||
-rw-r--r-- | test/test_utf8.c | 110 | ||||
-rw-r--r-- | test/testc.c | 2 | ||||
-rw-r--r-- | test/testp.c | 2 |
8 files changed, 287 insertions, 15 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000..a508f6a --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,55 @@ +if(MSVC) + if(MSVC_VERSION LESS "1900") + # < VS2015, no "/utf-8" option, can not build test + return() + endif() +endif() + +enable_testing() + +add_executable(test_utf8 test_utf8.c) +target_link_libraries(test_utf8 onig) +if(MSVC) + target_compile_options(test_utf8 PRIVATE /utf-8) +endif(MSVC) + +add_executable(test_syntax test_syntax.c) +target_link_libraries(test_syntax onig) +if(MSVC) + target_compile_options(test_syntax PRIVATE /utf-8) +endif(MSVC) + +add_executable(test_options test_options.c) +target_link_libraries(test_options onig) +if(MSVC) + target_compile_options(test_options PRIVATE /utf-8) +endif(MSVC) + +if(NOT MSVC) + # EUC + add_executable(testc testc.c) + target_link_libraries(testc onig) + if (CMAKE_C_COMPILER_ID MATCHES "Clang|GNU") + target_compile_options(testc PRIVATE -Wall -Wno-invalid-source-encoding) + endif() +endif(NOT MSVC) + +if(ENABLE_POSIX_API) + add_executable(testp testp.c) + target_link_libraries(testp onig) +endif() + +add_executable(testcu testu.c) +target_link_libraries(testcu onig) + +add_executable(test_regset test_regset.c) +target_link_libraries(test_regset onig) +if(MSVC) + target_compile_options(test_regset PRIVATE /utf-8) +endif(MSVC) + +add_executable(test_back test_back.c) +target_link_libraries(test_back onig) +if(MSVC) + target_compile_options(test_back PRIVATE /utf-8) +endif(MSVC) diff --git a/test/test.sh b/test/test.sh new file mode 100755 index 0000000..08c52a8 --- /dev/null +++ b/test/test.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +echo "[Oniguruma API, UTF-8 check]" +./test_utf8 | grep RESULT +echo "[Oniguruma API, SYNTAX check]" +./test_syntax | grep RESULT +echo "[Oniguruma API, Options check]" +./test_options | grep RESULT +echo "[Oniguruma API, EUC-JP check]" +./testc | grep RESULT +echo "[Oniguruma API, UTF-16 check]" +./testcu | grep RESULT +echo "" +echo "[Oniguruma API, regset check]" +./test_regset +echo "[Oniguruma API, backward search check]" +./test_back | grep RESULT diff --git a/test/test_back.c b/test/test_back.c index 9a6e4a8..52f2e58 100644 --- a/test/test_back.c +++ b/test/test_back.c @@ -1,6 +1,6 @@ /* * test_back.c - * Copyright (c) 2020-2021 K.Kosako + * Copyright (c) 2020-2024 K.Kosako */ #ifdef ONIG_ESCAPE_UCHAR_COLLISION #undef ONIG_ESCAPE_UCHAR_COLLISION @@ -64,7 +64,7 @@ static void xx(char* pattern, char* str, int from, int to, int mem, int not, r = onig_search(reg, (UChar* )str, (UChar* )(str + SLEN(str)), (UChar* )(str + SLEN(str)), (UChar* )str, region, ONIG_OPTION_NONE); - if (r < ONIG_MISMATCH) { + if (r < ONIG_MISMATCH || error_no < ONIG_MISMATCH) { char s[ONIG_MAX_ERROR_MESSAGE_LEN]; if (error_no == 0) { @@ -609,7 +609,7 @@ extern int main(int argc, char* argv[]) n("\\A(a|b\\g<1>c)\\k<1+3>\\z", "bbaccb"); x2("(?i)\\A(a|b\\g<1>c)\\k<1+2>\\z", "bBACcbac", 0, 8); x2("(?i)(?<X>aa)|(?<X>bb)\\k<X>", "BBbb", 0, 4); - x2("(?:\\k'+1'B|(A)C)*", "ACAB", 4, 4); // relative backref by postitive number + x2("(?:\\k'+1'B|(A)C)*", "ACAB", 4, 4); // relative backref by positive number x2("\\g<+2>(abc)(ABC){0}", "ABCabc", 0, 6); // relative call by positive number x2("A\\g'0'|B()", "AAAAB", 4, 5); x3("(A\\g'0')|B", "AAAAB", -1, -1, 1); diff --git a/test/test_options.c b/test/test_options.c index 7010f0f..9aa2538 100644 --- a/test/test_options.c +++ b/test/test_options.c @@ -1,6 +1,6 @@ /* * test_options.c - * Copyright (c) 2020-2021 K.Kosako + * Copyright (c) 2020-2024 K.Kosako */ #ifdef ONIG_ESCAPE_UCHAR_COLLISION #undef ONIG_ESCAPE_UCHAR_COLLISION @@ -64,7 +64,7 @@ static void xx(OnigOptionType options, char* pattern, char* str, r = onig_search(reg, (UChar* )str, (UChar* )(str + SLEN(str)), (UChar* )str, (UChar* )(str + SLEN(str)), region, options); - if (r < ONIG_MISMATCH) { + if (r < ONIG_MISMATCH || error_no < ONIG_MISMATCH) { char s[ONIG_MAX_ERROR_MESSAGE_LEN]; if (error_no == 0) { @@ -197,6 +197,11 @@ extern int main(int argc, char* argv[]) n(ONIG_OPTION_NOT_END_STRING, "ab\\Z", "ab"); n(ONIG_OPTION_NOT_END_STRING, "ab\\Z", "ab\n"); + x2(ONIG_OPTION_NONE, "a|abc", "abc", 0, 1); + x2(ONIG_OPTION_NONE, "(a|abc)\\Z", "abc", 0, 3); + x2(ONIG_OPTION_MATCH_WHOLE_STRING, "a|abc", "abc", 0, 3); + x2(ONIG_OPTION_MATCH_WHOLE_STRING, "a|abc", "a", 0, 1); + x2(ONIG_OPTION_WORD_IS_ASCII, "\\w", "@g", 1, 2); n(ONIG_OPTION_WORD_IS_ASCII, "\\w", "あ"); x2(ONIG_OPTION_NONE, "\\d", "1", 0, 3); @@ -219,6 +224,5 @@ extern int main(int argc, char* argv[]) onig_region_free(region, 1); onig_end(); - return ((nfail == 0 && nerror == 0) ? 0 : -1); } diff --git a/test/test_syntax.c b/test/test_syntax.c index b501ccd..4dcecf8 100644 --- a/test/test_syntax.c +++ b/test/test_syntax.c @@ -1,6 +1,6 @@ /* * test_syntax.c - * Copyright (c) 2019-2021 K.Kosako + * Copyright (c) 2019-2024 K.Kosako */ #ifdef ONIG_ESCAPE_UCHAR_COLLISION #undef ONIG_ESCAPE_UCHAR_COLLISION @@ -65,7 +65,7 @@ static void xx(char* pattern, char* str, int from, int to, int mem, int not, r = onig_search(reg, (UChar* )str, (UChar* )(str + SLEN(str)), (UChar* )str, (UChar* )(str + SLEN(str)), region, ONIG_OPTION_NONE); - if (r < ONIG_MISMATCH) { + if (r < ONIG_MISMATCH || error_no < ONIG_MISMATCH) { char s[ONIG_MAX_ERROR_MESSAGE_LEN]; if (error_no == 0) { @@ -205,6 +205,16 @@ static int test_look_behind() x2("(?<=a|b)c", "abc", 2, 3); x2("(?<=a|(.))\\1", "abcc", 3, 4); + // #295 + n("(?<!RMA)X", "123RMAX"); + x2("(?<=RMA)X", "123RMAX", 6, 7); + n("(?<!RMA)$", "123RMA"); + x2("(?<=RMA)$", "123RMA", 6, 6); + n("(?<!RMA)\\Z", "123RMA"); + x2("(?<=RMA)\\Z", "123RMA", 6, 6); + n("(?<!RMA)\\z", "123RMA"); + x2("(?<=RMA)\\z", "123RMA", 6, 6); + // following is not match in Perl and Java //x2("(?<=a|(.))\\1", "aa", 1, 2); @@ -213,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); @@ -259,6 +283,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]; @@ -277,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); @@ -291,6 +340,10 @@ extern int main(int argc, char* argv[]) test_isolated_option(); test_prec_read(); test_look_behind(); + test_char_class(); + + n("[[:digit:]]", "1"); + x2("[[:digit:]]", "g", 0, 1); x2("(?<=ab|(.))\\1", "abb", 2, 3); n("(?<!ab|b)c", "bbc"); n("(?<!b|ab)c", "bbc"); @@ -301,6 +354,9 @@ extern int main(int argc, char* argv[]) test_python_option_ascii(); test_python_z(); test_python_single_multi(); + + n("[[:digit:]]", "1"); + x2("[[:digit:]]", "g]", 0, 2); x2("(?P<name>abc)", "abc", 0, 3); x2("(?P<name>abc)(?P=name)", "abcabc", 0, 6); x2("(?P<name>abc){0}(?P>name)", "abc", 0, 3); @@ -309,6 +365,46 @@ 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); + x2("*", "*", 0, 1); + x2("^*", "*", 0, 1); + x2("abc\\|?", "?", 0, 1); + x2("\\{1\\}", "{1}", 0, 3); + x2("^\\{1\\}", "{1}", 0, 3); + x2("\\(\\{1\\}\\)", "{1}", 0, 3); + x2("^\\(\\{1\\}\\)", "{1}", 0, 3); + x2("{1}", "{1}", 0, 3); + x2("^{1}", "{1}", 0, 3); + x2("\\({1}\\)", "{1}", 0, 3); + x2("^\\({1}\\)", "{1}", 0, 3); + x2("{1,2}", "{1,2}", 0, 5); + x2("^{1,2}", "{1,2}", 0, 5); + x2("\\({1,2}\\)", "{1,2}", 0, 5); + x2("^\\({1,2}\\)", "{1,2}", 0, 5); + + Syntax = ONIG_SYNTAX_EMACS; + x2("\\(abc\\)", "abc", 0, 3); + x2("\\(?:abc\\)", "abc", 0, 3); + x3("\\(?:abc\\)\\(xyz\\)", "abcxyz", 3, 6, 1); + + 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", diff --git a/test/test_utf8.c b/test/test_utf8.c index 75392e8..01c0a5c 100644 --- a/test/test_utf8.c +++ b/test/test_utf8.c @@ -1,6 +1,6 @@ /* * test_utf8.c - * Copyright (c) 2019-2022 K.Kosako + * Copyright (c) 2019-2024 K.Kosako */ #ifdef ONIG_ESCAPE_UCHAR_COLLISION #undef ONIG_ESCAPE_UCHAR_COLLISION @@ -64,7 +64,7 @@ static void xx(char* pattern, char* str, int from, int to, int mem, int not, r = onig_search(reg, (UChar* )str, (UChar* )(str + SLEN(str)), (UChar* )str, (UChar* )(str + SLEN(str)), region, ONIG_OPTION_NONE); - if (r < ONIG_MISMATCH) { + if (r < ONIG_MISMATCH || error_no < ONIG_MISMATCH) { char s[ONIG_MAX_ERROR_MESSAGE_LEN]; if (error_no == 0) { @@ -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); @@ -731,7 +752,7 @@ extern int main(int argc, char* argv[]) n("\\A(a|b\\g<1>c)\\k<1+3>\\z", "bbaccb"); x2("(?i)\\A(a|b\\g<1>c)\\k<1+2>\\z", "bBACcbac", 0, 8); x2("(?i)(?<X>aa)|(?<X>bb)\\k<X>", "BBbb", 0, 4); - x2("(?:\\k'+1'B|(A)C)*", "ACAB", 0, 4); // relative backref by postitive number + x2("(?:\\k'+1'B|(A)C)*", "ACAB", 0, 4); // relative backref by positive number x2("\\g<+2>(abc)(ABC){0}", "ABCabc", 0, 6); // relative call by positive number x2("A\\g'0'|B()", "AAAAB", 0, 5); x3("(A\\g'0')|B", "AAAAB", 0, 5, 1); @@ -1460,6 +1481,15 @@ extern int main(int argc, char* argv[]) n("(\\k<2>)|(?<=(\\k<1>))", ""); x2("(a|\\k<2>)|(?<=(\\k<1>))", "a", 0, 1); x2("(a|\\k<2>)|(?<=b(\\k<1>))", "ba", 1, 2); + // #295 + n("(?<!RMA)X", "123RMAX"); + x2("(?<=RMA)X", "123RMAX", 6, 7); + n("(?<!RMA)$", "123RMA"); + x2("(?<=RMA)$", "123RMA", 6, 6); + n("(?<!RMA)\\Z", "123RMA"); + x2("(?<=RMA)\\Z", "123RMA", 6, 6); + n("(?<!RMA)\\z", "123RMA"); + x2("(?<=RMA)\\z", "123RMA", 6, 6); x2("((?(a)\\g<1>|b))", "aab", 0, 3); x2("((?(a)\\g<1>))", "aab", 0, 2); @@ -1618,17 +1648,86 @@ extern int main(int argc, char* argv[]) 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); + x2("(?Ii)$", "", 0, 0); + x2("(?Ii)|", "", 0, 0); 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); 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); + x2("(?L)z|a\\g<0>a", "aazaa", 0, 5); + x2("(?Li)z|a\\g<0>a", "aazAA", 0, 5); + x2("(?Li:z|a\\g<0>a)", "aazAA", 0, 5); + x2("(?L)z|a\\g<0>a", "aazaaaazaaaa", 3, 12); + + // 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 */ @@ -1663,6 +1762,7 @@ extern int main(int argc, char* argv[]) e("(?m:*)", "abc", ONIGERR_TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED); x2("(?:)*", "abc", 0, 0); e("^*", "abc", ONIGERR_TARGET_OF_REPEAT_OPERATOR_INVALID); + e("abc|?", "", ONIGERR_TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED); fprintf(stdout, "\nRESULT SUCC: %4d, FAIL: %d, ERROR: %d (by Oniguruma %s)\n", diff --git a/test/testc.c b/test/testc.c index 5f7c4f0..6c4125c 100644 --- a/test/testc.c +++ b/test/testc.c @@ -520,7 +520,7 @@ extern int main(int argc, char* argv[]) n("[0-9-a]", ":"); // PR#44 x3("(\\(((?:[^(]|\\g<1>)*)\\))", "(abc)(abc)", 1, 4, 2); // PR#43 x2("\\o{101}", "A", 0, 1); - x2("(?:\\k'+1'B|(A)C)*", "ACAB", 0, 4); // relative backref by postitive number + x2("(?:\\k'+1'B|(A)C)*", "ACAB", 0, 4); // relative backref by positive number x2("\\g<+2>(abc)(ABC){0}", "ABCabc", 0, 6); // relative call by positive number x2("A\\g'0'|B()", "AAAAB", 0, 5); x3("(A\\g'0')|B", "AAAAB", 0, 5, 1); diff --git a/test/testp.c b/test/testp.c index 3158925..de577a2 100644 --- a/test/testp.c +++ b/test/testp.c @@ -503,7 +503,7 @@ extern int main(int argc, char* argv[]) n("[0-9-a]", ":"); // PR#44 x3("(\\(((?:[^(]|\\g<1>)*)\\))", "(abc)(abc)", 1, 4, 2); // PR#43 x2("\\o{101}", "A", 0, 1); - x2("(?:\\k'+1'B|(A)C)*", "ACAB", 0, 4); // relative backref by postitive number + x2("(?:\\k'+1'B|(A)C)*", "ACAB", 0, 4); // relative backref by positive number x2("\\g<+2>(abc)(ABC){0}", "ABCabc", 0, 6); // relative call by positive number x2("A\\g'0'|B()", "AAAAB", 0, 5); x3("(A\\g'0')|B", "AAAAB", 0, 5, 1); |