This is an automated email from the ASF dual-hosted git repository. mgrigorov pushed a commit to branch avro-3494-uncomment-passing-tests in repository https://gitbox.apache.org/repos/asf/avro.git
commit 5c15f4c3d0a45989695cbe0977c4341a17c646d1 Author: Martin Tzvetanov Grigorov <[email protected]> AuthorDate: Mon Apr 18 22:20:39 2022 +0300 AVRO-3494: Uncomment a test for recursive types Signed-off-by: Martin Tzvetanov Grigorov <[email protected]> --- lang/rust/avro/tests/schema.rs | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/lang/rust/avro/tests/schema.rs b/lang/rust/avro/tests/schema.rs index 1410424ba..f58b62f9e 100644 --- a/lang/rust/avro/tests/schema.rs +++ b/lang/rust/avro/tests/schema.rs @@ -565,12 +565,6 @@ lazy_static! { EXAMPLES.iter().copied().filter(|s| s.1).collect(); } -/* -// TODO: (#92) properly support recursive types and uncomment - -This test is failing unwrapping the outer schema with ParseSchemaError("Unknown type: X"). It seems -that recursive types are not properly supported. - #[test] fn test_correct_recursive_extraction() { init(); @@ -594,21 +588,31 @@ fn test_correct_recursive_extraction() { ] }"#; let outer_schema = Schema::parse_str(raw_outer_schema).unwrap(); - if let Schema::Record { fields: outer_fields, .. } = outer_schema { - let raw_inner_schema = outer_fields[0].schema.canonical_form(); - let inner_schema = Schema::parse_str(raw_inner_schema.as_str()).unwrap(); - if let Schema::Record { fields: inner_fields, .. } = inner_schema { - if let Schema::Record {name: recursive_type, .. } = &inner_fields[0].schema { + if let Schema::Record { + fields: outer_fields, + .. + } = outer_schema + { + let inner_schema = &outer_fields[0].schema; + if let Schema::Record { + fields: inner_fields, + .. + } = inner_schema + { + if let Schema::Record { + name: recursive_type, + .. + } = &inner_fields[0].schema + { assert_eq!("X", recursive_type.name.as_str()); } } else { - panic!("inner schema {} should have been a record", raw_inner_schema) + panic!("inner schema {:?} should have been a record", inner_schema) } } else { - panic!("outer schema {} should have been a record", raw_outer_schema) + panic!("outer schema {:?} should have been a record", outer_schema) } } -*/ #[test] fn test_parse() {
