diff --git a/src/convert.rs b/src/convert.rs index 75e1ff8..4cf5d39 100644 --- a/src/convert.rs +++ b/src/convert.rs @@ -62,8 +62,8 @@ pub fn convert_to_mltt( for key in combinators { if let Some(value) = map.get(&key) { while let Some(index) = text_to_convert.find(&key) { - let middle_char = get_prev_char(&text_to_convert, index); - let mid_val = map.get(&format!("{}", middle_char)).unwrap(); + let middle_char = get_prev_char(&text_to_convert, index).to_string(); + let mid_val = map.get(&middle_char).unwrap_or(&middle_char); let split_val = value.split("").collect::>(); let new_key = format!("{}{}", middle_char, key); let new_val = format!("{}{}{}", split_val[1], mid_val, split_val[2]); diff --git a/tests/convertion.rs b/tests/convertion.rs index 0a3244d..5374f81 100644 --- a/tests/convertion.rs +++ b/tests/convertion.rs @@ -88,6 +88,38 @@ fn convert_case_short_8() -> Result<(), Box> { ) } +#[test] +fn convert_case_short_9() -> Result<(), Box> { + test_convertion( + r#"പൊടുന്നനെ"#, + r#"s]mSp¶s\"# + ) +} + +#[test] +fn convert_case_short_10() -> Result<(), Box> { + test_convertion( + r#"കിളികൊല്ലൂർ"#, + r#"InfnsImÃqÀ"# + ) +} + +#[test] +fn convert_case_short_11() -> Result<(), Box> { + test_convertion( + r#"കോയമ്പത്തൂർ"#, + r#"tImb¼¯qÀ"# + ) +} + +#[test] +fn convert_case_short_12() -> Result<(), Box> { + test_convertion( + r#"മുക്കോലയ്ക്കൽ"#, + r#"apt¡mebv¡Â"# + ) +} + #[test] fn convert_case_long_1() -> Result<(), Box> { test_convertion(