MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / test_truncate_string_unicode

Function test_truncate_string_unicode

atomic-cli/src/commands/log/tests.rs:987–998  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

985
986 #[test]
987 fn test_truncate_string_unicode() {
988 // Unicode characters should be handled correctly (counting chars, not bytes)
989 let result = truncate_string("Hello 世界!", 10);
990 // String has 10 chars, so should not be truncated
991 assert_eq!(result, "Hello 世界!");
992
993 // Test actual truncation with unicode
994 let result2 = truncate_string("Hello 世界!", 8);
995 // Should truncate to 5 chars + "..."
996 assert!(result2.ends_with("..."));
997 assert_eq!(result2.chars().count(), 8);
998 }
999
1000 #[test]
1001 fn test_format_author_empty_name() {

Callers

nothing calls this directly

Calls 1

truncate_stringFunction · 0.70

Tested by

no test coverage detected