You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@avro.apache.org by GitBox <gi...@apache.org> on 2022/07/21 09:01:30 UTC
[GitHub] [avro] martin-g commented on a diff in pull request #1775: Avro 3584 rust unit test
martin-g commented on code in PR #1775:
URL: https://github.com/apache/avro/pull/1775#discussion_r926433924
##########
lang/rust/avro/src/schema.rs:
##########
@@ -2030,6 +2030,51 @@ mod tests {
assert_eq!(schema_c, schema_c_expected);
}
+ // AVRO-3584 : recursion in type definitions
+ #[test]
+ fn test_recursion_records() {
+ use std::iter::FromIterator;
+
+ // A and B are the same except the name.
+ let schema_str_a = r#"{
+ "name": "A",
+ "type": "record",
+ "fields": [ {"name": "field_one", "type": "B"} ]
+ }"#;
+
+ let schema_str_b = r#"{
+ "name": "B",
+ "type": "record",
+ "fields": [ {"name": "field_one", "type": "A"} ]
+ }"#;
+
+ let list = Schema::parse_list(&[schema_str_a, schema_str_b])
+ .unwrap();
+
+ let schema_a = list
+ .first()
+ .unwrap()
+ .clone();
+ let schema_b = list
+ .get(1)
+ .unwrap()
+ .clone();
+
+ match schema_a {
+ Schema::Record { fields, .. } => {
+ let f1 = fields.get(0);
+ let string = f1.unwrap().schema.canonical_form();
Review Comment:
`string` looks unused
##########
lang/rust/avro/src/schema.rs:
##########
@@ -2030,6 +2030,51 @@ mod tests {
assert_eq!(schema_c, schema_c_expected);
}
+ // AVRO-3584 : recursion in type definitions
+ #[test]
+ fn test_recursion_records() {
Review Comment:
```suggestion
fn avro_3584_test_recursion_records() {
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@avro.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org