* [PATCH] New regex testcases
@ 2003-10-02 14:55 Jakub Jelinek
0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2003-10-02 14:55 UTC (permalink / raw)
To: Ulrich Drepper, bonzini; +Cc: Glibc hackers
Hi!
Current CVS fails tests 8 and 9 in bug-regex11 with the patch below,
without the last posix/regcomp.c revert test 4 fails and all other
succeed.
Haven't tried latest Paolo's patch yet.
2003-10-02 Jakub Jelinek <jakub@redhat.com>
* posix/bug-regex11.c (tests): Add new tests.
* posix/bug-regex12.c (tests): Add new test.
--- libc/posix/bug-regex11.c.jj 2002-10-17 19:15:06.000000000 +0200
+++ libc/posix/bug-regex11.c 2003-10-02 16:33:38.000000000 +0200
@@ -1,5 +1,5 @@
/* Regular expression tests.
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
@@ -41,7 +41,17 @@ struct
{ { 0, 21 }, { 8, 9 }, { 9, 10 } } },
{ "^\\(a*\\)\\1\\{9\\}\\(a\\{0,9\\}\\)\\([0-9]*;.*[^a]\\2\\([0-9]\\)\\)",
"a1;;0a1aa2aaa3aaaa4aaaaa5aaaaaa6aaaaaaa7aaaaaaaa8aaaaaaaaa9aa2aa1a0", 0,
- 5, { { 0, 67 }, { 0, 0 }, { 0, 1 }, { 1, 67 }, { 66, 67 } } }
+ 5, { { 0, 67 }, { 0, 0 }, { 0, 1 }, { 1, 67 }, { 66, 67 } } },
+ /* Test for BRE expression anchoring. POSIX says just that this may match;
+ in glibc regex it always matched, so avoid changing it. */
+ { "\\(^\\|foo\\)bar", "bar", 0, 2, { { 0, 3 }, { -1, -1 } } },
+ { "\\(foo\\|^\\)bar", "bar", 0, 2, { { 0, 3 }, { -1, -1 } } },
+ /* In ERE this must be treated as an anchor. */
+ { "(^|foo)bar", "bar", REG_EXTENDED, 2, { { 0, 3 }, { -1, -1 } } },
+ { "(foo|^)bar", "bar", REG_EXTENDED, 2, { { 0, 3 }, { -1, -1 } } },
+ /* 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 } } }
};
int
--- libc/posix/bug-regex12.c.jj 2002-09-30 09:47:16.000000000 +0200
+++ libc/posix/bug-regex12.c 2003-10-02 16:41:16.000000000 +0200
@@ -1,5 +1,5 @@
/* Regular expression tests.
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
@@ -32,7 +32,9 @@ struct
int flags, nmatch;
} tests[] = {
{ "^<\\([^~]*\\)\\([^~]\\)[^~]*~\\1\\(.\\).*|=.*\\3.*\\2",
- "<,.8~2,~so-|=-~.0,123456789<><", REG_NOSUB, 0, }
+ "<,.8~2,~so-|=-~.0,123456789<><", REG_NOSUB, 0 },
+ /* In ERE, all carets must be treated as anchors. */
+ { "a^b", "a^b", REG_EXTENDED, 0 }
};
int
Jakub
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-10-02 14:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-02 14:55 [PATCH] New regex testcases Jakub Jelinek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).