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 P arg - password protected */ DEFINE_TEST(test_P_encryption)10DEFINE_TEST(test_P_encryption) 11 { 12 const char *reffile = "test_encrypted.zip"; 13 int r; 14 15 extract_reference_file(reffile); 16 r = systemf("%s -P password %s >test.out 2>test.err", testprog, reffile); 17 if (r == 256) { 18 assertTextFileContents("unzip: Decryption is unsupported due to lack of crypto library\n", "test.err"); 19 } else { 20 assertEqualInt(0, r); 21 assertNonEmptyFile("test.out"); 22 assertEmptyFile("test.err"); 23 24 assertTextFileContents("plaintext\n", "encrypted/file.txt"); 25 } 26 } 27