Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc2f0cf6

Browse files
committed
Fix typo and add a new test
1 parentda19f75 commitc2f0cf6

File tree

2 files changed

+44
-3
lines changed

2 files changed

+44
-3
lines changed

‎src/mixed_script.rs‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,13 @@ impl fmt::Display for AugmentedScriptSet {
113113
write!(f,"All")?;
114114
}else{
115115
letmut first_entry =true;
116-
let hanb =ifself.hanb{Some("Han with Bopomofo")}else{None};
116+
let hanb =ifself.hanb{
117+
Some("Han with Bopomofo")
118+
}else{
119+
None
120+
};
117121
let jpan =ifself.jpan{Some("Japanese")}else{None};
118-
let kore =ifself.kore{Some("Krorean")}else{None};
122+
let kore =ifself.kore{Some("Korean")}else{None};
119123
for writing_systeminNone
120124
.into_iter()
121125
.chain(hanb)

‎src/tests.rs‎

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ fn test_potential_mixed_script_detection() {
7979
}
8080

8181
#[test]
82-
fntest_augmented_script_set(){
82+
fntest_augmented_script_set_fmt_debug(){
8383
usecrate::mixed_script::AugmentedScriptSet;
8484
let augmented_script_sets =vec![
8585
AugmentedScriptSet::default(),
@@ -114,3 +114,40 @@ fn test_augmented_script_set() {
114114
assert_eq!(format!("{:?}", ss), output);
115115
}
116116
}
117+
118+
#[test]
119+
fntest_augmented_script_set_fmt_display(){
120+
usecrate::mixed_script::AugmentedScriptSet;
121+
let augmented_script_sets =vec![
122+
AugmentedScriptSet::default(),
123+
AugmentedScriptSet::from('0'),
124+
AugmentedScriptSet::from('a'),
125+
AugmentedScriptSet::from('μ'),
126+
AugmentedScriptSet::from('汉'),
127+
AugmentedScriptSet::from('ひ'),
128+
AugmentedScriptSet::from('カ'),
129+
AugmentedScriptSet::from('한'),
130+
AugmentedScriptSet::from("汉ひ"),
131+
AugmentedScriptSet::from("汉a"),
132+
AugmentedScriptSet::from("汉μ"),
133+
AugmentedScriptSet::from("〆切"),
134+
];
135+
let debug_output =vec![
136+
"All",
137+
"All",
138+
"Latin",
139+
"Greek",
140+
"Han with Bopomofo, Japanese, Korean, Han",
141+
"Japanese, Hiragana",
142+
"Japanese, Katakana",
143+
"Korean, Hangul",
144+
"Japanese",
145+
"Empty",
146+
"Empty",
147+
"Han with Bopomofo, Japanese, Korean, Han",
148+
];
149+
150+
for(ss, output)in augmented_script_sets.into_iter().zip(debug_output){
151+
assert_eq!(format!("{}", ss), output);
152+
}
153+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp