From 29db3b90328498474388e9cfb2c8ef6d816c05c2 Mon Sep 17 00:00:00 2001 From: ngie Date: Sat, 3 Dec 2016 02:47:16 +0000 Subject: 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 --- contrib/netbsd-tests/lib/libc/gen/t_fnmatch.c | 29 +++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'contrib/netbsd-tests/lib/libc/gen/t_fnmatch.c') 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 -__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 #include @@ -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(); } -- cgit v1.1