Skip to content

Commit

Permalink
JSON形式辞書対応でテストが通ってないのを修正
Browse files Browse the repository at this point in the history
  • Loading branch information
mtgto committed Aug 18, 2024
1 parent 6a3c7b3 commit 9ee928b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions macSKKTests/FileDictTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ final class FileDictTests: XCTestCase {
func testSerialize() throws {
let dict = try FileDict(contentsOf: fileURL, type: .traditional(.utf8), readonly: false)
XCTAssertEqual(dict.serialize(),
[FileDict.headers[0], FileDict.okuriAriHeader, FileDict.okuriNashiHeader, ""].joined(separator: "\n").data(using: .utf8))
[FileDict.headers[0], FileDict.okuriAriHeader, FileDict.okuriNashiHeader, ""].joined(separator: "\n"))
dict.add(yomi: "", word: Word("", annotation: Annotation(dictId: "testDict", text: "亜の注釈")))
dict.add(yomi: "", word: Word("", annotation: Annotation(dictId: "testDict", text: "阿の注釈")))
dict.add(yomi: "あr", word: Word("", annotation: Annotation(dictId: "testDict", text: "有の注釈")))
Expand All @@ -83,7 +83,7 @@ final class FileDictTests: XCTestCase {
"あ /阿;阿の注釈/亜;亜の注釈/",
"",
].joined(separator: "\n")
XCTAssertEqual(dict.serialize(), expected.data(using: .utf8))
XCTAssertEqual(dict.serialize(), expected)
// 追加したエントリはシリアライズ時は先頭に付く
dict.add(yomi: "", word: Word(""))
dict.add(yomi: "いr", word: Word(""))
Expand All @@ -97,7 +97,7 @@ final class FileDictTests: XCTestCase {
"あ /阿;阿の注釈/亜;亜の注釈/",
"",
].joined(separator: "\n")
XCTAssertEqual(dict.serialize(), expected.data(using: .utf8))
XCTAssertEqual(dict.serialize(), expected)
// 追加更新した場合は順序を変更する。削除更新した場合は順序を変更しない
XCTAssertTrue(dict.delete(yomi: "", word: ""))
dict.add(yomi: "あr", word: Word(""))
Expand All @@ -110,6 +110,6 @@ final class FileDictTests: XCTestCase {
"い /伊/",
"",
].joined(separator: "\n")
XCTAssertEqual(dict.serialize(), expected.data(using: .utf8))
XCTAssertEqual(dict.serialize(), expected)
}
}

0 comments on commit 9ee928b

Please sign in to comment.