MCPcopy Create free account
hub / github.com/hashintel/hash / decode_eof_with_partial_data

Function decode_eof_with_partial_data

libs/@local/codec/src/bytes.rs:400–413  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

398
399 #[test]
400 fn decode_eof_with_partial_data() {
401 // Setup
402 let mut decoder = JsonLinesDecoder::<TestItem>::new();
403 let mut buffer = BytesMut::from(&br#"{"id":1,"name":"incomplete"}"#[..]);
404
405 // Call decode_eof - should return the item even without a newline
406 let result = decoder
407 .decode_eof(&mut buffer)
408 .expect("should successfully decode at EOF");
409 assert!(result.is_some(), "Should decode partial data at EOF");
410 let item = result.expect("should have a decoded item");
411 assert_eq!(item.id, 1);
412 assert_eq!(item.name, "incomplete");
413 }
414
415 #[test]
416 fn decode_with_very_large_input() {

Callers

nothing calls this directly

Calls 3

decode_eofMethod · 0.80
fromFunction · 0.50
expectMethod · 0.45

Tested by

no test coverage detected