xref: /freebsd/contrib/libarchive/unzip/test/test_doubledash.c (revision bd66c1b43e33540205dbc1187c2f2a15c58b57ba)
1b9128a37SMartin Matuska /*
2*bd66c1b4SMartin Matuska  * SPDX-License-Identifier: BSD-2-Clause
3*bd66c1b4SMartin Matuska  *
4b9128a37SMartin Matuska  * Copyright (c) 2023 Adrian Vovk
5b9128a37SMartin Matuska  * All rights reserved.
6b9128a37SMartin Matuska  */
7b9128a37SMartin Matuska #include "test.h"
8b9128a37SMartin Matuska 
9b9128a37SMartin Matuska /* Test double dash arg - swallow "--" and use next argument as file name  */
DEFINE_TEST(test_doubledash)10b9128a37SMartin Matuska DEFINE_TEST(test_doubledash)
11b9128a37SMartin Matuska {
12b9128a37SMartin Matuska 	const char *reffile = "test_basic.zip";
13b9128a37SMartin Matuska 	int r;
14b9128a37SMartin Matuska 
15b9128a37SMartin Matuska 	extract_reference_file(reffile);
16b9128a37SMartin Matuska 	r = systemf("%s -- %s >test.out 2>test.err", testprog, reffile);
17b9128a37SMartin Matuska 	assertEqualInt(0, r);
18b9128a37SMartin Matuska 	assertNonEmptyFile("test.out");
19b9128a37SMartin Matuska 	assertEmptyFile("test.err");
20b9128a37SMartin Matuska 
21b9128a37SMartin Matuska 	assertTextFileContents("contents a\n", "test_basic/a");
22b9128a37SMartin Matuska 	assertTextFileContents("contents b\n", "test_basic/b");
23b9128a37SMartin Matuska 	assertTextFileContents("contents c\n", "test_basic/c");
24b9128a37SMartin Matuska 	assertTextFileContents("contents CAPS\n", "test_basic/CAPS");
25b9128a37SMartin Matuska }
26