Skip to content

Commit

Permalink
Debug Linux test
Browse files Browse the repository at this point in the history
  • Loading branch information
weichsel committed Jun 9, 2024
1 parent ebf55de commit 53a1677
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
1 change: 1 addition & 0 deletions Sources/ZIPFoundation/Archive+MemoryFile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ private func closeStub(_ cookie: UnsafeMutableRawPointer?) -> Int32 {
}

#if os(macOS) || os(iOS) || os(tvOS) || os(visionOS) || os(watchOS) || os(Android)

private func readStub(_ cookie: UnsafeMutableRawPointer?,
_ bytePtr: UnsafeMutablePointer<Int8>?,
_ count: Int32) -> Int32 {
Expand Down
4 changes: 2 additions & 2 deletions Sources/ZIPFoundation/Archive.swift
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public final class Archive: Sequence {
setvbuf(self.archiveFile, nil, _IOFBF, Int(defaultPOSIXBufferSize))
}

#if swift(>=5.0)
#if swift(>=5.0)
var memoryFile: MemoryFile?

/// Initializes a new in-memory ZIP `Archive`.
Expand Down Expand Up @@ -204,7 +204,7 @@ public final class Archive: Sequence {
self.endOfCentralDirectoryRecord = config.endOfCentralDirectoryRecord
self.zip64EndOfCentralDirectory = config.zip64EndOfCentralDirectory
}
#endif
#endif

deinit {
fclose(self.archiveFile)
Expand Down
19 changes: 9 additions & 10 deletions Tests/ZIPFoundationTests/ZIPFoundationMemoryTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,13 @@ extension ZIPFoundationTests {
let data = Data.makeRandomData(size: 1024)
XCTAssertSwiftError(try Archive(data: data, accessMode: .read),
throws: Archive.ArchiveError.missingEndOfCentralDirectoryRecord)
// let archive = self.memoryArchive(for: #function, mode: .create)
// let replacementArchive = self.memoryArchive(for: #function, mode: .read)
// replacementArchive.memoryFile = nil
// XCTAssertSwiftError(
// try archive.replaceCurrentArchive(with: replacementArchive),
// throws: Archive.ArchiveError.unwritableArchive
// )
let archive = self.memoryArchive(for: #function, mode: .create)
let replacementArchive = self.memoryArchive(for: #function, mode: .read)
//replacementArchive.memoryFile = nil

Check failure on line 119 in Tests/ZIPFoundationTests/ZIPFoundationMemoryTests.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Comment Spacing Violation: Prefer at least one space after slashes for comments (comment_spacing)
XCTAssertSwiftError(
try archive.replaceCurrentArchive(with: replacementArchive),
throws: Archive.ArchiveError.unwritableArchive
)
}

func testReadOnlyFile() {
Expand Down Expand Up @@ -192,9 +192,8 @@ extension ZIPFoundationTests {
sourceArchiveURL.appendPathExtension("zip")
do {
let data = mode == .create ? Data() : try Data(contentsOf: sourceArchiveURL)
let archive = try Archive(data: data, accessMode: mode,
pathEncoding: pathEncoding)
return archive
return try Archive(data: data, accessMode: mode,
pathEncoding: pathEncoding)
} catch {
XCTFail("Failed to open memory archive for '\(sourceArchiveURL.lastPathComponent)'")
type(of: self).tearDown()
Expand Down

0 comments on commit 53a1677

Please sign in to comment.