diff --git a/SWCompression.xcodeproj/project.pbxproj b/SWCompression.xcodeproj/project.pbxproj index ec22184c..b1054a13 100644 --- a/SWCompression.xcodeproj/project.pbxproj +++ b/SWCompression.xcodeproj/project.pbxproj @@ -222,6 +222,7 @@ E60CBA8A26AF379200A20130 /* test_only_dir_header.tar in Resources */ = {isa = PBXBuildFile; fileRef = E60CBA8926AF379200A20130 /* test_only_dir_header.tar */; }; E631055927084D5D006EACC3 /* LZ4+Compress.swift in Sources */ = {isa = PBXBuildFile; fileRef = E631055827084D5D006EACC3 /* LZ4+Compress.swift */; }; E6421E8F271B54C6000359B6 /* test_7z_lz4.7z in Resources */ = {isa = PBXBuildFile; fileRef = E6421E8E271B54C6000359B6 /* test_7z_lz4.7z */; }; + E644E11E2833AB2400EEFBAD /* minimal.gz in Resources */ = {isa = PBXBuildFile; fileRef = E644E11D2833AB2400EEFBAD /* minimal.gz */; }; E648151D26A889B8009261F0 /* TarHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = E648151C26A889B8009261F0 /* TarHeader.swift */; }; E64F71BC26AAFD6A008BB308 /* Data+Tar.swift in Sources */ = {isa = PBXBuildFile; fileRef = E64F71BB26AAFD6A008BB308 /* Data+Tar.swift */; }; E6522FB42789AF9600026B56 /* TarReaderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6522FB32789AF9600026B56 /* TarReaderTests.swift */; }; @@ -506,6 +507,7 @@ E631055827084D5D006EACC3 /* LZ4+Compress.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "LZ4+Compress.swift"; sourceTree = ""; }; E631055A27086132006EACC3 /* SWCompression.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; name = SWCompression.xctestplan; path = SWCompression.xcodeproj/SWCompression.xctestplan; sourceTree = SOURCE_ROOT; }; E6421E8E271B54C6000359B6 /* test_7z_lz4.7z */ = {isa = PBXFileReference; lastKnownFileType = file; path = test_7z_lz4.7z; sourceTree = ""; }; + E644E11D2833AB2400EEFBAD /* minimal.gz */ = {isa = PBXFileReference; lastKnownFileType = archive.gzip; path = minimal.gz; sourceTree = ""; }; E648151C26A889B8009261F0 /* TarHeader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TarHeader.swift; sourceTree = ""; }; E64F71BB26AAFD6A008BB308 /* Data+Tar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Data+Tar.swift"; sourceTree = ""; }; E6522FB32789AF9600026B56 /* TarReaderTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TarReaderTests.swift; sourceTree = ""; }; @@ -868,6 +870,7 @@ 06F065B81FFB763300312A82 /* GZip */ = { isa = PBXGroup; children = ( + E644E11D2833AB2400EEFBAD /* minimal.gz */, 06F065BA1FFB763300312A82 /* test1.gz */, 06F065BF1FFB763300312A82 /* test2.gz */, 06F065BC1FFB763300312A82 /* test3.gz */, @@ -1283,6 +1286,7 @@ 069864CA21403CE700755D9B /* test_sha256.xz in Resources */, E652D8F3263D670900FC229B /* test_nonstandard_runlength.bz2 in Resources */, 06F0663D1FFB763400312A82 /* test2.xz in Resources */, + E644E11E2833AB2400EEFBAD /* minimal.gz in Resources */, 06F066351FFB763400312A82 /* test5.xz in Resources */, 06F066631FFB763400312A82 /* test_complicated_coding_scheme.7z in Resources */, E652FECE27007E79006BC312 /* test8.lz4 in Resources */, diff --git a/Tests/GzipTests.swift b/Tests/GzipTests.swift index aaab6db9..08e1fd3b 100644 --- a/Tests/GzipTests.swift +++ b/Tests/GzipTests.swift @@ -195,4 +195,23 @@ class GzipTests: XCTestCase { } } + func testMinimal() throws { + // In this test we test several things: + // - that the archive consisting only of the minimal header is successfully processed, + // - that the mtime field with the value 0 correctly results in a `GzipHeader.modificationTime == nil`, + // - that the `GzipArchive.multiUnarchive(archive:)` works on a single member archive. + let testData = try Constants.data(forTest: "minimal", withType: GzipTests.testType) + let members = try GzipArchive.multiUnarchive(archive: testData) + XCTAssertEqual(members.count, 1) + if let member = members.first { + XCTAssertEqual(member.header.compressionMethod, .deflate) + XCTAssertNil(member.header.modificationTime) + XCTAssertEqual(member.header.osType, .unix) + XCTAssertNil(member.header.fileName) + XCTAssertNil(member.header.comment) + XCTAssertFalse(member.header.isTextFile) + XCTAssertEqual(member.data, Data()) + } + } + } diff --git a/Tests/Test Files b/Tests/Test Files index c3c60dce..fd8ea9a9 160000 --- a/Tests/Test Files +++ b/Tests/Test Files @@ -1 +1 @@ -Subproject commit c3c60dce0922fee1c45c37c6ff7d05e46835f2c9 +Subproject commit fd8ea9a9d415e01e66f464edf4212e51fe07d9c2