()
| 271 | /// Non-map inputs must return None from build. |
| 272 | #[test] |
| 273 | fn fuzz_non_map_inputs() { |
| 274 | let array_buf = encode(&json!([1, 2, 3])); |
| 275 | assert!(FieldIndex::build(&array_buf, 0).is_none()); |
| 276 | |
| 277 | let int_buf = encode(&json!(99)); |
| 278 | assert!(FieldIndex::build(&int_buf, 0).is_none()); |
| 279 | |
| 280 | assert!(FieldIndex::build(&[], 0).is_none()); |
| 281 | |
| 282 | let nil_buf = [0xc0u8]; |
| 283 | assert!(FieldIndex::build(&nil_buf, 0).is_none()); |
| 284 | } |
| 285 | |
| 286 | /// Out-of-bounds offset must return None. |
| 287 | #[test] |