fix: itta-then-delete crash

This commit is contained in:
ensan-hcl
2025-07-15 14:05:44 -07:00
parent 1757546802
commit 48c267f47e
3 changed files with 31 additions and 5 deletions

View File

@ -132,6 +132,30 @@ final class ConverterTests: XCTestCase {
}
}
// memo: fatalError
func testIttaAndThenDelete() async throws {
let converter = await KanaKanjiConverter()
var c = ComposingText()
let text = "itta"
//
let possibles = [
"いった",
"行った",
"言った"
]
for char in text {
c.insertAtCursorPosition(String(char), inputStyle: .roman2kana)
let results = await converter.requestCandidates(c, options: requestOptions())
if c.input.count == text.count {
XCTAssertTrue(possibles.contains(results.mainResults.first!.text))
}
}
// 1
c.deleteBackwardFromCursorPosition(count: 1)
let results = await converter.requestCandidates(c, options: requestOptions())
XCTAssertTrue(results.mainResults.contains { $0.text == "言っ" })
}
// 1
// memo: deleted_last_n
func testGradualConversionWithDelete() async throws {