Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/contrib/libarchive/unzip/test/test_n.c
107672 views
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 n arg - don't overwrite existing files */
10
DEFINE_TEST(test_n)
11
{
12
#ifdef HAVE_LIBZ
13
const char *reffile = "test_basic.zip";
14
int r;
15
16
assertMakeDir("test_basic", 0755);
17
assertMakeFile("test_basic/a", 0644, "orig a\n");
18
assertMakeFile("test_basic/b", 0644, "orig b\n");
19
20
extract_reference_file(reffile);
21
r = systemf("%s -n %s >test.out 2>test.err", testprog, reffile);
22
assertEqualInt(0, r);
23
assertNonEmptyFile("test.out");
24
assertEmptyFile("test.err");
25
26
assertTextFileContents("orig a\n", "test_basic/a");
27
assertTextFileContents("orig b\n", "test_basic/b");
28
assertTextFileContents("contents c\n", "test_basic/c");
29
assertTextFileContents("contents CAPS\n", "test_basic/CAPS");
30
#else
31
skipping("zlib not available");
32
#endif
33
}
34
35