summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2017-08-13 13:55:30 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2017-08-13 13:55:30 +0200
commita89a4ac904bc93b1d93b410394fa05c23260351b (patch)
treeb10c64aff1d79627925154364772774fc82d07ff /test
parentb6c6e4122f35fbead1e9661dfb2d852b39faf8ff (diff)
parentae063b1e6ea3d97ea4e3404bfd8289895619d04f (diff)
Merge branch 'release/6.5.0-1'6.5.0-1
Diffstat (limited to 'test')
-rw-r--r--test/testc.c82
-rw-r--r--test/testu.c9
2 files changed, 91 insertions, 0 deletions
diff --git a/test/testc.c b/test/testc.c
index 725e375..222c9cd 100644
--- a/test/testc.c
+++ b/test/testc.c
@@ -590,6 +590,88 @@ extern int main(int argc, char* argv[])
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);
+ x2("(a*)(?(1))aa", "aaaaa", 0, 5);
+ x2("(a*)(?(-1))aa", "aaaaa", 0, 5);
+ x2("(?<name>aaa)(?('name'))aa", "aaaaa", 0, 5);
+ x2("(a)(?(1)aa|bb)a", "aaaaa", 0, 4);
+ x2("(?:aa|())(?(<1>)aa|bb)a", "aabba", 0, 5);
+ x2("(?:aa|())(?('1')aa|bb|cc)a", "aacca", 0, 5);
+ x3("(a*)(?(1)aa|a)b", "aaab", 0, 1, 1);
+ n("(a)(?(1)a|b)c", "abc");
+ x2("(a)(?(1)|)c", "ac", 0, 2);
+ n("(?()aaa|bbb)", "bbb");
+ x2("(a)(?(1+0)b|c)d", "abd", 0, 3);
+ x2("(?:(?'name'a)|(?'name'b))(?('name')c|d)e", "ace", 0, 3);
+ x2("(?:(?'name'a)|(?'name'b))(?('name')c|d)e", "bce", 0, 3);
+ x2("\\R", "\r\n", 0, 2);
+ x2("\\R", "\r", 0, 1);
+ x2("\\R", "\n", 0, 1);
+ x2("\\R", "\x0b", 0, 1);
+ n("\\R\\n", "\r\n");
+ n("\\R", "\xc2\x85"); // because euc-jp is not Unicode
+ x2("\\N", "a", 0, 1);
+ n("\\N", "\n");
+ n("(?m:\\N)", "\n");
+ n("(?-m:\\N)", "\n");
+ x2("\\O", "a", 0, 1);
+ x2("\\O", "\n", 0, 1);
+ x2("(?m:\\O)", "\n", 0, 1);
+ x2("(?-m:\\O)", "\n", 0, 1);
+ x2("\\K", "a", 0, 0);
+ x2("a\\K", "a", 1, 1);
+ x2("a\\Kb", "ab", 1, 2);
+ x2("(a\\Kb|ac\\Kd)", "acd", 2, 3);
+ x2("(a\\Kb|\\Kac\\K)*", "acababacab", 9, 10);
+
+ x2("(?~)", "", 0, 0);
+ x2("(?~)", "A", 0, 0);
+ x2("aaaaa(?~)", "aaaaaaaaaa", 0, 5);
+ x2("(?~(?:|aaa))", "aaa", 0, 0);
+ x2("(?~aaa|)", "aaa", 0, 0);
+ x2("a(?~(?~)).", "abcdefghijklmnopqrstuvwxyz", 0, 26); // !!!
+ x2("/\\*(?~\\*/)\\*/", "/* */ */", 0, 5);
+ x2("(?~\\w+)zzzzz", "zzzzz", 0, 5);
+ x2("(?~\\w*)zzzzz", "zzzzz", 0, 5);
+ x2("(?~A.C|B)", "ABC", 0, 0);
+ x2("(?~XYZ|ABC)a", "ABCa", 1, 4);
+ x2("(?~XYZ|ABC)a", "aABCa", 0, 1);
+ x2("<[^>]*>(?~[<>])</[^>]*>", "<a>vvv</a> <b> </b>", 0, 10);
+ x2("(?~ab)", "ccc\ndab", 0, 5);
+ x2("(?m:(?~ab))", "ccc\ndab", 0, 5);
+ x2("(?-m:(?~ab))", "ccc\ndab", 0, 5);
+
+ // absent with expr
+ x2("(?~|78|\\d*)", "123456789", 0, 6);
+ x2("(?~|def|(?:abc|de|f){0,100})", "abcdedeabcfdefabc", 0, 11);
+ x2("(?~|ab|.*)", "ccc\nddd", 0, 3);
+ x2("(?~|ab|\\O*)", "ccc\ndab", 0, 5);
+ x2("(?~|ab|\\O{2,10})", "ccc\ndab", 0, 5);
+ x2("(?~|ab|\\O{1,10})", "ab", 1, 2);
+ n("(?~|ab|\\O{2,10})", "ab");
+ x2("(?~|abc|\\O{1,10})", "abc", 1, 3);
+ x2("(?~|ab|\\O{5,10})|abc", "abc", 0, 3);
+ x2("(?~|ab|\\O{1,10})", "cccccccccccab", 0, 10);
+ x2("(?~|aaa|)", "aaa", 0, 0);
+ x2("(?~||a*)", "aaaaaa", 0, 0);
+ x2("(?~||a*?)", "aaaaaa", 0, 0);
+ x2("(a)(?~|b|\\1)", "aaaaaa", 0, 2);
+ x2("(a)(?~|bb|(?:a\\1)*)", "aaaaaa", 0, 5);
+ x2("(b|c)(?~|abac|(?:a\\1)*)", "abababacabab", 1, 4);
+ n("(?~|c|a*+)a", "aaaaa");
+ x2("(?~|aaaaa|a*+)", "aaaaa", 0, 0);
+ x2("(?~|aaaaaa|a*+)b", "aaaaaab", 1, 7);
+ x2("(?~|abcd|(?>))", "zzzabcd", 0, 0);
+
+ // absent range cutter
+ x2("(?~|abc)a*", "aaaaaabc", 0, 5);
+ x2("(?~|abc)a*z|aaaaaabc", "aaaaaabc", 0, 8);
+ x2("(?~|aaaaaa)a*", "aaaaaa", 0, 0);
+ x2("(?~|abc)aaaa|aaaabc", "aaaabc", 0, 6);
+ x2("(?>(?~|abc))aaaa|aaaabc", "aaaabc", 0, 6);
+ x2("(?~|)a", "a", 0, 1);
+ n("(?~|a)a", "a");
+ x2("(?~|a)(?~|)a", "a", 0, 1);
+ x2("(?~|a).*(?~|)a", "bbbbbbbbbbbbbbbbbbbba", 0, 21);
/*
< ifndef IGNORE_EUC_JP >
diff --git a/test/testu.c b/test/testu.c
index 017ebef..6ff3a10 100644
--- a/test/testu.c
+++ b/test/testu.c
@@ -905,6 +905,15 @@ extern int main(int argc, char* argv[])
x2("\000^\000\\\000p\000{\000K\000a\000t\000a\000k\000a\000n\000a\000}\000$\000\000", "\060\277\000\000", 0, 2);
x2("\000\\\000o\000{\0001\0000\0001\000}\000\000", "\000A\000\000", 0, 2);
x2("\000\\\000o\000{\0001\0001\0000\0007\0002\0001\000}\000\000", "\221\321\000\000", 0, 2);
+ x2("\000\\\000R\000\000", "\000\015\000\012\000\000", 0, 4); // \R: general newline
+ x2("\000\\\000R\000\000", "\000\012\000\000", 0, 2);
+ x2("\000\\\000R\000\000", "\000\015\000\000", 0, 2);
+ x2("\000\\\000R\000\000", "\000\013\000\000", 0, 2);
+ n("\000\\\000R\000\012\000\000", "\000\015\000\012\000\000");
+ x2("\000\\\000R\000\000", "\x00\x85\000\000", 0, 2);
+ x2("\000\\\000R\000\000", "\x20\x28\000\000", 0, 2);
+ x2("\000\\\000R\000\000", "\x20\x29\000\000", 0, 2);
+ n("\000\\\000R\000\000", "\x20\x2a\000\000");
fprintf(stdout,
"\nRESULT SUCC: %d, FAIL: %d, ERROR: %d (by Oniguruma %s)\n",