xref: /freebsd/contrib/libarchive/unzip/test/test_glob.c (revision bd66c1b43e33540205dbc1187c2f2a15c58b57ba)
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 	const char *reffile = "test_basic.zip";
13 	int r;
14 
15 	extract_reference_file(reffile);
16 	r = systemf("%s %s test_*/[ab] >test.out 2>test.err", testprog, reffile);
17 	assertEqualInt(0, r);
18 	assertNonEmptyFile("test.out");
19 	assertEmptyFile("test.err");
20 
21 	assertTextFileContents("contents a\n", "test_basic/a");
22 	assertTextFileContents("contents b\n", "test_basic/b");
23 	assertFileNotExists("test_basic/c");
24 	assertFileNotExists("test_basic/CAPS");
25 }
26