xref: /freebsd/contrib/libarchive/unzip/test/test_glob.c (revision 401026e4825a05abba6f945cf1b74b3328876fa2)
1 /*
2  * SPDX-License-Identifier: BSD-2-Clause
3  *
4  * Copyright (c) 2023 Adrian Vovk
5  * All rights reserved.
6  */
7 #include "test.h"
8 
9 /* Test that the glob works */
DEFINE_TEST(test_glob)10 DEFINE_TEST(test_glob)
11 {
12 #ifdef HAVE_LIBZ
13 	const char *reffile = "test_basic.zip";
14 	int r;
15 
16 	extract_reference_file(reffile);
17 	r = systemf("%s %s test_*/[ab] >test.out 2>test.err", testprog, reffile);
18 	assertEqualInt(0, r);
19 	assertNonEmptyFile("test.out");
20 	assertEmptyFile("test.err");
21 
22 	assertTextFileContents("contents a\n", "test_basic/a");
23 	assertTextFileContents("contents b\n", "test_basic/b");
24 	assertFileNotExists("test_basic/c");
25 	assertFileNotExists("test_basic/CAPS");
26 #else
27 	skipping("zlib not available");
28 #endif
29 }
30