Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Add test for string with unicode characters

Petros Amoiridisbe0241bab13a
diff --git a/crates/util/src/lib.rs b/crates/util/src/lib.rs
index 8cdbfc64380..0e270db906c 100644
--- a/crates/util/src/lib.rs
+++ b/crates/util/src/lib.rs
@@ -276,4 +276,15 @@ mod tests {
assert_eq!(foo, None);
}
+
+ #[test]
+ fn test_trancate_and_trailoff() {
+ const MAX_CHARS: usize = 24;
+ assert_eq!(
+ truncate_and_trailoff("ajouter un compte d'èèèès", MAX_CHARS),
+ "ajouter un compte d'è…"
+ );
+ assert_eq!(truncate_and_trailoff("ajouter", MAX_CHARS), "ajouter");
+ assert_eq!(truncate_and_trailoff("", MAX_CHARS), "");
+ }
}