]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - posix/bug-regex19.c
Update copyright notices with scripts/update-copyrights.
[thirdparty/glibc.git] / posix / bug-regex19.c
index 01093e60acd247b9ed7020e01865c8f760949fcf..3ae4cab79555028a661da7023148761e075d0cd3 100644 (file)
@@ -1,5 +1,5 @@
 /* Regular expression tests.
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003-2013 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
 
@@ -14,9 +14,8 @@
    Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
 
 #include <sys/types.h>
 #include <mcheck.h>
@@ -102,6 +101,20 @@ static struct test_s
   {ERE, ".\\b.", "=A=", 0, 0},
   {ERE, ".\\b.", "==", 0, -1},
   {ERE, ".\\b.", "ABA", 0, -1},
+  {ERE, "[^k]\\b[^k]", "AA~", 0, 1},
+  {ERE, "[^k]\\b[^k]", "=A=", 0, 0},
+  {ERE, "[^k]\\b[^k]", "Ak~kA~", 0, 4},
+  {ERE, "[^k]\\b[^k]", "==", 0, -1},
+  {ERE, "[^k]\\b[^k]", "ABA", 0, -1},
+  {ERE, "[^k]\\b[^k]", "Ak~", 0, -1},
+  {ERE, "[^k]\\b[^k]", "k=k", 0, -1},
+  {ERE, "[^C]\\b[^C]", "AA~", 0, 1},
+  {ERE, "[^C]\\b[^C]", "=A=", 0, 0},
+  {ERE, "[^C]\\b[^C]", "AC~CA~", 0, 4},
+  {ERE, "[^C]\\b[^C]", "==", 0, -1},
+  {ERE, "[^C]\\b[^C]", "ABA", 0, -1},
+  {ERE, "[^C]\\b[^C]", "AC~", 0, -1},
+  {ERE, "[^C]\\b[^C]", "C=C", 0, -1},
   {ERE, "\\<(A|!|.B)", "A=AC", 0, 0},
   {ERE, "\\<(A|!|.B)", "=AC", 0, 1},
   {ERE, "\\<(A|!|.B)", "!AC", 0, 1},
@@ -140,12 +153,38 @@ static struct test_s
   {ERE, ".\\<.", "AA~", 0, -1},
   {ERE, ".\\<.", "==", 0, -1},
   {ERE, ".\\<.", "ABA", 0, -1},
+  {ERE, "[^k]\\<[^k]", "=k=A=", 0, 2},
+  {ERE, "[^k]\\<[^k]", "kk~", 0, -1},
+  {ERE, "[^k]\\<[^k]", "==", 0, -1},
+  {ERE, "[^k]\\<[^k]", "ABA", 0, -1},
+  {ERE, "[^k]\\<[^k]", "=k=", 0, -1},
+  {ERE, "[^C]\\<[^C]", "=C=A=", 0, 2},
+  {ERE, "[^C]\\<[^C]", "CC~", 0, -1},
+  {ERE, "[^C]\\<[^C]", "==", 0, -1},
+  {ERE, "[^C]\\<[^C]", "ABA", 0, -1},
+  {ERE, "[^C]\\<[^C]", "=C=", 0, -1},
   {ERE, ".\\B.", "ABA", 0, 0},
   {ERE, ".\\B.", "=BDC", 0, 1},
-  {ERE, ".(\\b|\\B).", "=~AB", 0, 1},
+  {ERE, "[^k]\\B[^k]", "kkkABA", 0, 3},
+  {ERE, "[^k]\\B[^k]", "kBk", 0, -1},
+  {ERE, "[^C]\\B[^C]", "CCCABA", 0, 3},
+  {ERE, "[^C]\\B[^C]", "CBC", 0, -1},
+  {ERE, ".(\\b|\\B).", "=~AB", 0, 0},
   {ERE, ".(\\b|\\B).", "A=C", 0, 0},
   {ERE, ".(\\b|\\B).", "ABC", 0, 0},
-  {ERE, ".(\\b|\\B).", "=~\\!", 0, -1},
+  {ERE, ".(\\b|\\B).", "=~\\!", 0, 0},
+  {ERE, "[^k](\\b|\\B)[^k]", "=~AB", 0, 0},
+  {ERE, "[^k](\\b|\\B)[^k]", "A=C", 0, 0},
+  {ERE, "[^k](\\b|\\B)[^k]", "ABC", 0, 0},
+  {ERE, "[^k](\\b|\\B)[^k]", "=~kBD", 0, 0},
+  {ERE, "[^k](\\b|\\B)[^k]", "=~\\!", 0, 0},
+  {ERE, "[^k](\\b|\\B)[^k]", "=~kB", 0, 0},
+  {ERE, "[^C](\\b|\\B)[^C]", "=~AB", 0, 0},
+  {ERE, "[^C](\\b|\\B)[^C]", "A=C", 0, 0},
+  {ERE, "[^C](\\b|\\B)[^C]", "ABC", 0, 0},
+  {ERE, "[^C](\\b|\\B)[^C]", "=~CBD", 0, 0},
+  {ERE, "[^C](\\b|\\B)[^C]", "=~\\!", 0, 0},
+  {ERE, "[^C](\\b|\\B)[^C]", "=~CB", 0, 0},
   {ERE, "\\b([A]|[!]|.B)", "A=AC", 0, 0},
   {ERE, "\\b([A]|[!]|.B)", "=AC", 0, 1},
   {ERE, "\\b([A]|[!]|.B)", "!AC", 0, 1},
@@ -206,6 +245,9 @@ static struct test_s
   {ERE, "(\\<|[A].)[A~C]", "DACC", 0, 1},
   {ERE, "(\\<|[A].)[A~C]", "B!A=", 0, 2},
   {ERE, "(\\<|[A].)[A~C]", "B~C", 0, 2},
+  {ERE, "^[^A]*\\bB", "==B", 0, 0},
+  {ERE, "^[^A]*\\bB", "CBD!=B", 0, 0},
+  {ERE, "[^A]*\\bB", "==B", 2, 2}
 };
 
 int
@@ -288,6 +330,7 @@ do_mb_tests (const struct test_s *test)
   char string[strlen (test->string) * 4 + 1];
   char fail[8 + sizeof ("UTF-8 ")];
 
+  t = *test;
   t.pattern = pattern;
   t.string = string;
   strcpy (fail, "UTF-8 ");
@@ -367,9 +410,7 @@ main (void)
          ret = 1;
        }
       ret |= do_one_test (&tests[i], "UTF-8 ");
-      // Until the implementation is fixed, ignore the results of the
-      // MB tests.
-      /* ret |= */do_mb_tests (&tests[i]);
+      ret |= do_mb_tests (&tests[i]);
     }
 
   return ret;