MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / utf8_safety

Function utf8_safety

nodedb-query/src/chunk_text.rs:432–439  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

430
431 #[test]
432 fn utf8_safety() {
433 // Multi-byte characters: each emoji is 4 bytes but 1 char.
434 let text = "🌍🌎🌏🌍🌎🌏";
435 let chunks = chunk_text(text, 3, 0, ChunkStrategy::Character).unwrap();
436 assert_eq!(chunks.len(), 2);
437 assert_eq!(chunks[0].text, "🌍🌎🌏");
438 assert_eq!(chunks[1].text, "🌍🌎🌏");
439 }
440
441 #[test]
442 fn sentence_fallback_to_character() {

Callers

nothing calls this directly

Calls 1

chunk_textFunction · 0.85

Tested by

no test coverage detected