MCPcopy Create free account
hub / github.com/apache/avro-rs / test_avro_3433_recursive_definition_encode_map

Function test_avro_3433_recursive_definition_encode_map

avro/src/encode.rs:505–547  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

503
504 #[test]
505 fn test_avro_3433_recursive_definition_encode_map() {
506 let mut buf = Vec::new();
507 let schema = Schema::parse_str(
508 r#"
509 {
510 "type":"record",
511 "name":"TestStruct",
512 "fields": [
513 {
514 "name":"a",
515 "type":{
516 "type":"record",
517 "name": "Inner",
518 "fields": [ {
519 "name":"z",
520 "type":"int"
521 }]
522 }
523 },
524 {
525 "name":"b",
526 "type": {
527 "type":"map",
528 "values":"Inner"
529 }
530 }
531 ]
532 }"#,
533 )
534 .unwrap();
535
536 let inner_value1 = Value::Record(vec![("z".into(), Value::Int(3))]);
537 let inner_value2 = Value::Record(vec![("z".into(), Value::Int(6))]);
538 let outer_value = Value::Record(vec![
539 ("a".into(), inner_value1),
540 (
541 "b".into(),
542 Value::Map(vec![("akey".into(), inner_value2)].into_iter().collect()),
543 ),
544 ]);
545 encode(&outer_value, &schema, &mut buf).expect(&success(&outer_value, &schema));
546 assert!(!buf.is_empty());
547 }
548
549 #[test]
550 fn test_avro_3433_recursive_definition_encode_record_wrapper() {

Callers

nothing calls this directly

Calls 3

RecordClass · 0.85
encodeFunction · 0.85
successFunction · 0.85

Tested by

no test coverage detected