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 const char *reffile = "test_basic.zip"; 13 int r; 14 15 assertMakeDir("test_basic", 0755); 16 assertMakeFile("test_basic/a", 0644, "orig a\n"); 17 assertMakeFile("test_basic/b", 0644, "orig b\n"); 18 19 extract_reference_file(reffile); 20 r = systemf("%s -n %s >test.out 2>test.err", testprog, reffile); 21 assertEqualInt(0, r); 22 assertNonEmptyFile("test.out"); 23 assertEmptyFile("test.err"); 24 25 assertTextFileContents("orig a\n", "test_basic/a"); 26 assertTextFileContents("orig b\n", "test_basic/b"); 27 assertTextFileContents("contents c\n", "test_basic/c"); 28 assertTextFileContents("contents CAPS\n", "test_basic/CAPS"); 29 } 30