From 4d8236024952cc3c9915e9599e00bfd10b1ee3b8 Mon Sep 17 00:00:00 2001 From: Ivan Tham Date: Fri, 28 May 2021 01:19:22 +0800 Subject: [PATCH] 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. --- src/cargo/util/progress.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/cargo/util/progress.rs b/src/cargo/util/progress.rs index 45bb4d89eaa..4eb21467447 100644 --- a/src/cargo/util/progress.rs +++ b/src/cargo/util/progress.rs @@ -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]