martin-g commented on a change in pull request #1379:
URL: https://github.com/apache/avro/pull/1379#discussion_r737186050
##########
File path: lang/rust/src/reader.rs
##########
@@ -358,6 +394,23 @@ mod tests {
);
}
+ #[test]
+ fn test_from_avro_datum_with_union_to_struct() {
+ let schema = Schema::parse_str(TEST_RECORD_SCHEMA).unwrap();
+ let mut encoded: &'static [u8] = &[54, 6, 102, 111, 111];
+
+ let avro_datum = from_avro_datum(&schema, &mut encoded, None).unwrap();
+ let test_record: TestRecord = match &avro_datum {
+ Value::Record(_) => from_value::<TestRecord>(&avro_datum).unwrap(),
+ _ => panic!("could not map avro data to struct"),
+ };
+
+ assert_eq!(
+ test_record.a_nullable_array,
+ None
+ );
Review comment:
Please add assertions for all record fields.
Or one assertion for the whole struct. To actually use the `PartialEq` trait!
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]