Add additional test for CJK progress width

Not clear if CJK test hit boundary, since CJK characters have double width,
if we show an example with an extra single width means one of them hit
character boundary to be able to test ellipsis handling.
This commit is contained in:
Ivan Tham 2021-05-28 01:19:22 +08:00
parent e931e4796b
commit 4d82360249

View file

@ -393,6 +393,11 @@ fn test_progress_status() {
format.progress_status(3, 4, ":每個漢字佔據了兩個字元"),
Some("[=============> ] 3/4每個漢字佔據了...".to_string())
);
assert_eq!(
// handle breaking at middle of character
format.progress_status(3, 4, "-每個漢字佔據了兩個字元"),
Some("[=============> ] 3/4-每個漢字佔據了...".to_string())
);
}
#[test]