Sync source edition with VCC Plus 3.7.0 build 63
This commit is contained in:
1 parent
c652a5276d
commit
b2ecec4d87
86 files changed
+10519
-472
No files matched your search
@@ -18,6 +18,25 @@ final class SoftwareLibraryManualTests: XCTestCase {
|
||||
asset.manualURL = URL(string: "https://vccplus.brianholman.com/dl/software/CoCoLibrary/Documents/Manuals/Games/Manual.pdf")
|
||||
return (asset, bytes)
|
||||
}
|
||||
func testImportedUppercaseTextManualUsesTextReaderWithoutNetwork() async throws {
|
||||
let root = FileManager.default.temporaryDirectory.appendingPathComponent("PersonalManual-" + UUID().uuidString)
|
||||
defer { try? FileManager.default.removeItem(at: root) }
|
||||
let source = root.appendingPathComponent("Selected")
|
||||
try FileManager.default.createDirectory(at: source, withIntermediateDirectories: true)
|
||||
let text = Data("Authored local loading instructions\n".utf8)
|
||||
try text.write(to: source.appendingPathComponent("README.TXT"))
|
||||
try Data([0x12,0x39]).write(to: source.appendingPathComponent("GAME.ccc"))
|
||||
let store = PersonalSoftwareLibraryStore(root: root.appendingPathComponent("PersonalLibrary"))
|
||||
let draft = try await store.inspect([source]), entry = try await store.save(draft)
|
||||
let imported = await store.directory(for: entry.id)
|
||||
let manual = try XCTUnwrap(entry.release(in: imported).primaryManualAsset)
|
||||
let model = SoftwareLibraryManualModel(); model.open(manual, directory: root.appendingPathComponent("UnusedCache"))
|
||||
for _ in 0..<100 where model.loading { try await Task.sleep(nanoseconds: 10_000_000) }
|
||||
XCTAssertEqual(model.text, String(decoding: text, as: UTF8.self))
|
||||
XCTAssertNil(model.document); XCTAssertNil(model.error)
|
||||
XCTAssertEqual(try Data(contentsOf: source.appendingPathComponent("README.TXT")), text)
|
||||
model.cancel()
|
||||
}
|
||||
func testPlainTextDecodingPreservesInstructionsAndRejectsBinaryData() throws {
|
||||
XCTAssertEqual(try SoftwareLibraryManualModel.decodeText(Data("Z = start\r\nX = kick\u{1A}".utf8)), "Z = start\nX = kick")
|
||||
XCTAssertEqual(try SoftwareLibraryManualModel.decodeText(Data([0x63, 0x61, 0x66, 0xe9])), "café")
|
||||
|
||||
Reference in new issue
Block a user