1e64fe029SMartin Matuska /*
2*bd66c1b4SMartin Matuska * SPDX-License-Identifier: BSD-2-Clause
3*bd66c1b4SMartin Matuska *
4e64fe029SMartin Matuska * Copyright (c) 2023 Adrian Vovk
5e64fe029SMartin Matuska * All rights reserved.
6e64fe029SMartin Matuska */
7e64fe029SMartin Matuska #include "test.h"
8e64fe029SMartin Matuska
9*bd66c1b4SMartin Matuska /* Test o arg - overwrite existing files */
DEFINE_TEST(test_o)10e64fe029SMartin Matuska DEFINE_TEST(test_o)
11e64fe029SMartin Matuska {
12e64fe029SMartin Matuska const char *reffile = "test_basic.zip";
13e64fe029SMartin Matuska int r;
14e64fe029SMartin Matuska
15e64fe029SMartin Matuska assertMakeDir("test_basic", 0755);
16e64fe029SMartin Matuska assertMakeFile("test_basic/a", 0644, "orig a\n");
17e64fe029SMartin Matuska assertMakeFile("test_basic/b", 0644, "orig b\n");
18e64fe029SMartin Matuska
19e64fe029SMartin Matuska extract_reference_file(reffile);
20e64fe029SMartin Matuska r = systemf("%s -o %s >test.out 2>test.err", testprog, reffile);
21e64fe029SMartin Matuska assertEqualInt(0, r);
22e64fe029SMartin Matuska assertEmptyFile("test.err");
23e64fe029SMartin Matuska
24e64fe029SMartin Matuska assertTextFileContents("contents a\n", "test_basic/a");
25e64fe029SMartin Matuska assertTextFileContents("contents b\n", "test_basic/b");
26e64fe029SMartin Matuska assertTextFileContents("contents c\n", "test_basic/c");
27e64fe029SMartin Matuska assertTextFileContents("contents CAPS\n", "test_basic/CAPS");
28e64fe029SMartin Matuska }
29