aboutsummaryrefslogtreecommitdiffstats
path: root/libarchive/test/test_archive_read_next_header_empty.c
diff options
context:
space:
mode:
Diffstat (limited to 'libarchive/test/test_archive_read_next_header_empty.c')
-rw-r--r--libarchive/test/test_archive_read_next_header_empty.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/libarchive/test/test_archive_read_next_header_empty.c b/libarchive/test/test_archive_read_next_header_empty.c
index f650bccce89b..f43cbd934288 100644
--- a/libarchive/test/test_archive_read_next_header_empty.c
+++ b/libarchive/test/test_archive_read_next_header_empty.c
@@ -44,14 +44,9 @@ test_empty_file1(void)
}
static void
-test_empty_file2(void)
+test_empty_file2_check(struct archive* a)
{
- struct archive* a = archive_read_new();
struct archive_entry* e;
-
- /* Try opening an empty file with raw and empty handlers. */
- assertEqualInt(ARCHIVE_OK, archive_read_support_format_raw(a));
- assertEqualInt(ARCHIVE_OK, archive_read_support_format_empty(a));
assertEqualInt(0, archive_errno(a));
assertEqualString(NULL, archive_error_string(a));
@@ -67,6 +62,25 @@ test_empty_file2(void)
}
static void
+test_empty_file2(void)
+{
+ struct archive* a = archive_read_new();
+
+ /* Try opening an empty file with raw and empty handlers. */
+ assertEqualInt(ARCHIVE_OK, archive_read_support_format_raw(a));
+ assertEqualInt(ARCHIVE_OK, archive_read_support_format_empty(a));
+ test_empty_file2_check(a);
+
+ a = archive_read_new();
+ assertEqualInt(ARCHIVE_OK, archive_read_support_format_by_code(a, ARCHIVE_FORMAT_EMPTY));
+ test_empty_file2_check(a);
+
+ a = archive_read_new();
+ assertEqualInt(ARCHIVE_OK, archive_read_set_format(a, ARCHIVE_FORMAT_EMPTY));
+ test_empty_file2_check(a);
+}
+
+static void
test_empty_tarfile(void)
{
struct archive* a = archive_read_new();