Fix stupid bug in furigana application.
It would sometimes result in characters getting swapped.
This commit is contained in:
parent
4b48f86824
commit
0266341f99
11
src/lib.rs
11
src/lib.rs
|
@ -380,7 +380,7 @@ fn apply_furigana<'a>(
|
|||
}
|
||||
|
||||
// Left over.
|
||||
out.insert(out.len() - 2, (surface, kana));
|
||||
out.insert(out.len() - 1, (surface, kana));
|
||||
|
||||
out.iter().filter(|(s, _)| !s.is_empty()).copied().collect()
|
||||
}
|
||||
|
@ -540,6 +540,15 @@ mod tests {
|
|||
assert_eq!(&[("物の怪", "もののけ")], &pairs[..]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn apply_furigana_07() {
|
||||
let surface = "ご飯";
|
||||
let kana = "ゴハン";
|
||||
let pairs = apply_furigana(surface, kana, &FnvHashSet::default());
|
||||
|
||||
assert_eq!(&[("ご", ""), ("飯", "ハン")], &pairs[..]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn is_equivalent_kana_01() {
|
||||
assert!(is_equivalent_kana('か', 'カ'));
|
||||
|
|
Loading…
Reference in New Issue
Block a user