()
| 386 | pub(crate) fn success(value: &Value, schema: &Schema) -> String { |
| 387 | format!("Value: {value:?}\n should encode with schema:\n{schema:?}") |
| 388 | } |
| 389 | |
| 390 | #[test] |
| 391 | fn test_encode_empty_array() { |
| 392 | let mut buf = Vec::new(); |
| 393 | let empty: Vec<Value> = Vec::new(); |
| 394 | encode( |
| 395 | &Value::Array(empty.clone()), |
| 396 | &Schema::array(Schema::Int).build(), |
| 397 | &mut buf, |
| 398 | ) |
| 399 | .expect(&success( |
| 400 | &Value::Array(empty), |
| 401 | &Schema::array(Schema::Int).build(), |
| 402 | )); |
| 403 | assert_eq!(vec![0u8], buf); |
| 404 | } |