Adopted Array(capacity:) for the read wrappers throughout the library to adapt to Swift 6.4.

This commit is contained in:
2026-09-18 12:10:16 +02:00
parent 4cb0f8f500
commit 95ae01f97a
5 changed files with 47 additions and 24 deletions
+13
View File
@@ -345,6 +345,19 @@ struct WrapperTests {
#expect(Mock.eventCount("close") == 1)
}
@Test func fileHandleReadLengthReturnsOnlyTheBytesRead() throws {
let handle = try File.Handle(path: "save.dat", mode: [.read, .readData])
Mock.fileReadLimit = 3
#expect(try handle.read(length: 8) == [0xAB, 0xAB, 0xAB])
Mock.fileReadLimit = 0
#expect(try handle.read(length: 8).isEmpty)
Mock.fileReadLimit = -1
#expect(throws: PlaydateError.self) { try handle.read(length: 8) }
}
// MARK: JSON
@Test func jsonDecodeBuildsTheValueTree() throws {