summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ansi/mod.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/ansi/mod.rs b/src/ansi/mod.rs
index 33f4e3e7..442ead85 100644
--- a/src/ansi/mod.rs
+++ b/src/ansi/mod.rs
@@ -126,10 +126,10 @@ fn strip_ansi_codes_from_strings_iterator<'a>(
#[cfg(test)]
mod tests {
-
+ // Note that src/ansi/console_tests.rs contains additional test coverage for this module.
use super::{
ansi_preserving_slice, measure_text_width, parse_first_style,
- string_starts_with_ansi_style_sequence, strip_ansi_codes,
+ string_starts_with_ansi_style_sequence, strip_ansi_codes, truncate_str,
};
#[test]
@@ -206,4 +206,13 @@ mod tests {
"\x1b[1;36m\x1b[m\x1b[1;36m2222·2222·2222·2222\x1b[m\n"
)
}
+
+ #[test]
+ fn test_truncate_str() {
+ assert_eq!(truncate_str("1", 1, ""), "1");
+ assert_eq!(truncate_str("12", 1, ""), "1");
+ assert_eq!(truncate_str("123", 2, "s"), "1s");
+ assert_eq!(truncate_str("123", 2, "→"), "1→");
+ assert_eq!(truncate_str("12ݶ", 1, "ݶ"), "ݶ");
+ }
}