jklamer commented on code in PR #1914:
URL: https://github.com/apache/avro/pull/1914#discussion_r997707042


##########
lang/rust/avro/src/reader.rs:
##########
@@ -804,6 +804,38 @@ mod tests {
         assert_eq!(expected_value, val);
     }
 
+    #[test]
+    fn test_avro_3507_single_object_reader_incomplete_reads() {
+        let obj = TestSingleObjectReader {
+            a: 42,
+            b: 3.33,
+            c: vec!["cat".into(), "dog".into()],
+        };
+        let mut to_read_1 = Vec::<u8>::new();
+        to_read_1.extend_from_slice(&[0xC3, 0x01]);
+        let mut to_read_2 = Vec::<u8>::new();
+        to_read_2.extend_from_slice(
+            &TestSingleObjectReader::get_schema()
+                .fingerprint::<Rabin>()
+                .bytes[..],
+        );
+        let mut to_read_3 = Vec::<u8>::new();
+        encode(
+            &obj.clone().into(),
+            &TestSingleObjectReader::get_schema(),
+            &mut to_read_3,
+        )
+        .expect("Encode should succeed");
+        let mut to_read = 
(&to_read_1[..]).chain(&to_read_2[..]).chain(&to_read_3[..]);

Review Comment:
   interesting. `read` method would fail in this case? not would I would 
expect. Good catch!



-- 
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]

Reply via email to