Path: blob/main/contrib/libarchive/unzip/test/test_d.c
39483 views
/*1* SPDX-License-Identifier: BSD-2-Clause2*3* Copyright (c) 2023 Adrian Vovk4* All rights reserved.5*/6#include "test.h"78/* Test d arg - extract to target dir - before zipfile argument */9DEFINE_TEST(test_d_before_zipfile)10{11const char *reffile = "test_basic.zip";12int r;1314extract_reference_file(reffile);15r = systemf("%s -d foobar %s >test.out 2>test.err", testprog, reffile);16assertEqualInt(0, r);17assertNonEmptyFile("test.out");18assertEmptyFile("test.err");1920assertTextFileContents("contents a\n", "foobar/test_basic/a");21assertTextFileContents("contents b\n", "foobar/test_basic/b");22assertTextFileContents("contents c\n", "foobar/test_basic/c");23assertTextFileContents("contents CAPS\n", "foobar/test_basic/CAPS");24}2526/* Test d arg - extract to target dir - after zipfile argument */27DEFINE_TEST(test_d_after_zipfile)28{29const char *reffile = "test_basic.zip";30int r;3132extract_reference_file(reffile);33r = systemf("%s %s -d foobar >test.out 2>test.err", testprog, reffile);34assertEqualInt(0, r);35assertNonEmptyFile("test.out");36assertEmptyFile("test.err");3738assertTextFileContents("contents a\n", "foobar/test_basic/a");39assertTextFileContents("contents b\n", "foobar/test_basic/b");40assertTextFileContents("contents c\n", "foobar/test_basic/c");41assertTextFileContents("contents CAPS\n", "foobar/test_basic/CAPS");42}434445