From 23c9de60f30041419f3925221d4faff4e7a54717 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 16 Mar 2025 12:06:04 +0100 Subject: New upstream version 6.9.10 --- test/test_syntax.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 2 deletions(-) (limited to 'test/test_syntax.c') diff --git a/test/test_syntax.c b/test/test_syntax.c index b07fe67..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("(?abc)", "abc", 0, 3); x2("(?Pabc)(?P=name)", "abcabc", 0, 6); x2("(?Pabc){0}(?P>name)", "abc", 0, 3); @@ -340,6 +372,26 @@ extern int main(int argc, char* argv[]) 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; -- cgit v1.2.3