MCPcopy Create free account
hub / github.com/apache/arrow-rs / assert_json_eq

Function assert_json_eq

arrow-json/src/writer/mod.rs:501–513  ·  view source on GitHub ↗

Asserts that the NDJSON `input` is semantically identical to `expected`

(input: &[u8], expected: &str)

Source from the content-addressed store, hash-verified

499
500 /// Asserts that the NDJSON `input` is semantically identical to `expected`
501 fn assert_json_eq(input: &[u8], expected: &str) {
502 let expected: Vec<Option<Value>> = expected
503 .split('\n')
504 .map(|s| (!s.is_empty()).then(|| serde_json::from_str(s).unwrap()))
505 .collect();
506
507 let actual: Vec<Option<Value>> = input
508 .split(|b| *b == b'\n')
509 .map(|s| (!s.is_empty()).then(|| serde_json::from_slice(s).unwrap()))
510 .collect();
511
512 assert_eq!(actual, expected);
513 }
514
515 #[test]
516 fn write_simple_rows() {

Callers 15

write_simple_rowsFunction · 0.85
write_dictionaryFunction · 0.85
write_list_of_dictionaryFunction · 0.85
write_timestampsFunction · 0.85
write_timestamps_with_tzFunction · 0.85
write_datesFunction · 0.85
write_timesFunction · 0.85
write_durationsFunction · 0.85
write_nested_structsFunction · 0.85

Calls 4

from_sliceFunction · 0.85
collectMethod · 0.80
splitMethod · 0.45
is_emptyMethod · 0.45

Tested by 15

write_simple_rowsFunction · 0.68
write_dictionaryFunction · 0.68
write_list_of_dictionaryFunction · 0.68
write_timestampsFunction · 0.68
write_timestamps_with_tzFunction · 0.68
write_datesFunction · 0.68
write_timesFunction · 0.68
write_durationsFunction · 0.68
write_nested_structsFunction · 0.68