X-Git-Url: https://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=tests%2Ftest-fnmatch.c;h=71664a801702778ef48f624c1fec30f80e9828f3;hb=1bb384c44db25aef8f8b455cef22af32d8401abc;hp=f9485afcf16504d428b070a3059932b6659173ec;hpb=89ae4589dd58d12e7cbcf0e92c1d828c1e430f97;p=gnulib.git diff --git a/tests/test-fnmatch.c b/tests/test-fnmatch.c index f9485afcf..71664a801 100644 --- a/tests/test-fnmatch.c +++ b/tests/test-fnmatch.c @@ -1,5 +1,5 @@ /* Test of fnmatch string matching function. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,21 +23,7 @@ #include "signature.h" SIGNATURE_CHECK (fnmatch, int, (char const *, char const *, int)); -#include -#include - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", \ - __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -60,5 +46,11 @@ main () ASSERT (res = fnmatch ("foo\\.txt", "foo.txt", 0) == 0); ASSERT (res = fnmatch ("foo\\.txt", "foo.txt", FNM_NOESCAPE) == FNM_NOMATCH); + /* Verify that an unmatched [ is treated as a literal, as POSIX + requires. This test ensures that glibc Bugzilla bug #12378 stays + fixed. + */ + ASSERT (res = fnmatch ("[/b", "[/b", 0) == 0); + return 0; }