Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/contrib/libarchive/unzip/test/test_o.c
101184 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 o arg - overwrite existing files */
10
DEFINE_TEST(test_o)
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 -o %s >test.out 2>test.err", testprog, reffile);
22
assertEqualInt(0, r);
23
assertEmptyFile("test.err");
24
25
assertTextFileContents("contents a\n", "test_basic/a");
26
assertTextFileContents("contents b\n", "test_basic/b");
27
assertTextFileContents("contents c\n", "test_basic/c");
28
assertTextFileContents("contents CAPS\n", "test_basic/CAPS");
29
#else
30
skipping("zlib not available");
31
#endif
32
}
33
34