This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] New regex testcases


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]