summaryrefslogtreecommitdiffstats
path: root/contrib/netbsd-tests/lib/libc/gen/t_fnmatch.c
diff options
context:
space:
mode:
authorngie <ngie@FreeBSD.org>2016-12-03 02:47:16 +0000
committerngie <ngie@FreeBSD.org>2016-12-03 02:47:16 +0000
commit29db3b90328498474388e9cfb2c8ef6d816c05c2 (patch)
tree91ac81530a80d5ea64a24212d143cb2012f49a0a /contrib/netbsd-tests/lib/libc/gen/t_fnmatch.c
parent8408238ce58163c0d88dea333c155b6806aae830 (diff)
downloadFreeBSD-src-29db3b90328498474388e9cfb2c8ef6d816c05c2.zip
FreeBSD-src-29db3b90328498474388e9cfb2c8ef6d816c05c2.tar.gz
MFC r305358:
Update contrib/netbsd-tests with new content from NetBSD This updates the snapshot from 09/30/2014 to 08/11/2016 This brings in a number of new testcases from upstream, most notably: - bin/cat - lib/libc - lib/msun - lib/libthr - usr.bin/sort lib/libc/tests/stdio/open_memstream_test.c was moved to lib/libc/tests/stdio/open_memstream2_test.c to accomodate the new open_memstream test from NetBSD. Tested on: amd64 (VMware fusion VM; various bare metal platforms); i386 (VMware fusion VM); make tinderbox
Diffstat (limited to 'contrib/netbsd-tests/lib/libc/gen/t_fnmatch.c')
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/t_fnmatch.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/contrib/netbsd-tests/lib/libc/gen/t_fnmatch.c b/contrib/netbsd-tests/lib/libc/gen/t_fnmatch.c
index f90d8cf..c0064c3 100644
--- a/contrib/netbsd-tests/lib/libc/gen/t_fnmatch.c
+++ b/contrib/netbsd-tests/lib/libc/gen/t_fnmatch.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_fnmatch.c,v 1.3 2012/04/08 09:58:59 jruoho Exp $ */
+/* $NetBSD: t_fnmatch.c,v 1.6 2014/10/12 22:33:41 christos Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_fnmatch.c,v 1.3 2012/04/08 09:58:59 jruoho Exp $");
+__RCSID("$NetBSD: t_fnmatch.c,v 1.6 2014/10/12 22:33:41 christos Exp $");
#include <atf-c.h>
#include <fnmatch.h>
@@ -153,6 +153,30 @@ ATF_TC_BODY(fnmatch_period, tc)
ATF_CHECK(fnmatch("x/*y", "x/.y", FNM_PATHNAME | FNM_PERIOD) != 0);
}
+ATF_TC(fnmatch_initialbracket);
+ATF_TC_HEAD(fnmatch_initialbracket, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Test fnmatch with initial [");
+}
+
+ATF_TC_BODY(fnmatch_initialbracket, tc)
+{
+ ATF_CHECK(fnmatch("[[?*\\\\]", "\\", 0) == 0);
+ ATF_CHECK(fnmatch("[]?*\\\\]", "]", 0) == 0);
+ ATF_CHECK(fnmatch("[!]a-]", "b", 0) == 0);
+ ATF_CHECK(fnmatch("[]-_]", "^", 0) == 0); /* range: ']', '^', '_' */
+ ATF_CHECK(fnmatch("[!]-_]", "X", 0) == 0);
+ ATF_CHECK(fnmatch("[a-z]/[a-z]", "a/b", 0) == 0);
+ ATF_CHECK(fnmatch("[*]/b", "*/b", 0) == 0);
+ ATF_CHECK(fnmatch("[?]/b", "?/b", 0) == 0);
+ ATF_CHECK(fnmatch("[[a]/b", "a/b", 0) == 0);
+ ATF_CHECK(fnmatch("[[a]/b", "[/b", 0) == 0);
+ ATF_CHECK(fnmatch("[/b", "[/b", 0) == 0);
+
+ ATF_CHECK(fnmatch("[*]/b", "a/b", 0) != 0);
+ ATF_CHECK(fnmatch("[?]/b", "a/b", 0) != 0);
+}
+
ATF_TP_ADD_TCS(tp)
{
@@ -162,6 +186,7 @@ ATF_TP_ADD_TCS(tp)
ATF_TP_ADD_TC(tp, fnmatch_noescape);
ATF_TP_ADD_TC(tp, fnmatch_pathname);
ATF_TP_ADD_TC(tp, fnmatch_period);
+ ATF_TP_ADD_TC(tp, fnmatch_initialbracket);
return atf_no_error();
}
OpenPOWER on IntegriCloud