summaryrefslogtreecommitdiff
path: root/posix/bug-regex11.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-10-06 23:44:15 +0000
committerUlrich Drepper <drepper@redhat.com>2003-10-06 23:44:15 +0000
commitd0b96fc49b1535d820fe9680746677e55b8e83db (patch)
tree19a82c56117e67a1244125fa7141e1995cf17e43 /posix/bug-regex11.c
parent4bd2533694b5755da01c8c33184cdd0e14985cf4 (diff)
downloadglibc-d0b96fc49b1535d820fe9680746677e55b8e83db.tar.gz
Update.
* posix/bug-regex11.c: Add some more tests which fail so far. Disable them. Patch by Paolo Bonzini <bonzini@gnu.org>. 2003-10-05 Paolo Bonzini <bonzini@gnu.org> * posix/bug-regex11.c: Add more backreference-related test cases. (main): Show the failing regex in the error messages. * posix/regexec.c (check_dst_limits_calc_pos): Simplify some nested conditionals. Replace if's with a switch statement. (check_dst_limits_calc_pos <TYPE_BKREF>): Rename parameter NODE to FROM_NODE, it shadows a local variable; don't recurse if FROM_NODE does not change in the recursive invocation, fixing an infinite loop in the ()\1*\1* regex. (sift_states_backward): Fix function comment. * posix/regcomp.c (calc_epsdest): Add an assertion. 2003-10-06 Ulrich Drepper <drepper@redhat.com>
Diffstat (limited to 'posix/bug-regex11.c')
-rw-r--r--posix/bug-regex11.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/posix/bug-regex11.c b/posix/bug-regex11.c
index 40fd7c27f5..c7a8b6537a 100644
--- a/posix/bug-regex11.c
+++ b/posix/bug-regex11.c
@@ -35,6 +35,7 @@ struct
/* Test for newline handling in regex. */
{ "[^~]*~", "\nx~y", 0, 2, { { 0, 3 }, { -1, -1 } } },
/* Other tests. */
+ { "a(.*)b", "a b", REG_EXTENDED, 2, { { 0, 3 }, { 1, 2 } } },
{ ".*|\\([KIO]\\)\\([^|]*\\).*|?[KIO]", "10~.~|P|K0|I10|O16|?KSb", 0, 3,
{ { 0, 21 }, { 15, 16 }, { 16, 18 } } },
{ ".*|\\([KIO]\\)\\([^|]*\\).*|?\\1", "10~.~|P|K0|I10|O16|?KSb", 0, 3,
@@ -52,6 +53,18 @@ struct
/* Here ^ cannot be treated as an anchor according to POSIX. */
{ "(^|foo)bar", "(^|foo)bar", 0, 2, { { 0, 10 }, { -1, -1 } } },
{ "(foo|^)bar", "(foo|^)bar", 0, 2, { { 0, 10 }, { -1, -1 } } },
+ /* More tests on backreferences. */
+ { "()\\1*\\1*", "", REG_EXTENDED, 2, { { 0, 0 }, { 0, 0 } } },
+ { "([0-9]).*\\1(a*)", "7;7a6", REG_EXTENDED, 3, { { 0, 4 }, { 0, 1 }, { 3, 4 } } },
+ { "([0-9]).*\\1(a*)", "7;7a", REG_EXTENDED, 3, { { 0, 4 }, { 0, 1 }, { 3, 4 } } },
+#if 0
+ /* XXX This test seems wrong. --drepper */
+ { "()(b)\\1c\\2", "bcb", REG_EXTENDED, 3, { { 0, 3 }, { 0, 0 }, { 1, 2 } } },
+
+ /* XXX Not used since they fail so far. */
+ { "(b())\\2\\1", "bbbb", REG_EXTENDED, 3, { { 0, 2 }, { 0, 1 }, { 1, 1 } } },
+ { "(bb())\\2\\1", "bbbb", REG_EXTENDED, 3, { { 0, 4 }, { 0, 2 }, { 2, 2 } } },
+#endif
};
int
@@ -71,14 +84,14 @@ main (void)
{
char buf[500];
regerror (n, &re, buf, sizeof (buf));
- printf ("regcomp %zd failed: %s\n", i, buf);
+ printf ("%s: regcomp %zd failed: %s\n", tests[i].pattern, i, buf);
ret = 1;
continue;
}
if (regexec (&re, tests[i].string, tests[i].nmatch, rm, 0))
{
- printf ("regexec %zd failed\n", i);
+ printf ("%s: regexec %zd failed\n", tests[i].pattern, i);
ret = 1;
regfree (&re);
continue;
@@ -90,8 +103,8 @@ main (void)
{
if (tests[i].rm[n].rm_so == -1 && tests[i].rm[n].rm_eo == -1)
break;
- printf ("regexec match failure rm[%d] %d..%d\n",
- n, rm[n].rm_so, rm[n].rm_eo);
+ printf ("%s: regexec %zd match failure rm[%d] %d..%d\n",
+ tests[i].pattern, i, n, rm[n].rm_so, rm[n].rm_eo);
ret = 1;
break;
}