ultrabug edited a comment on pull request #1379:
URL: https://github.com/apache/avro/pull/1379#issuecomment-950775660


   Ok @martin-g in my quest to write a test for this (I fail so far) I found 
something that I clearly do not understand but which triggers the same Error 
than my initial problem here.
   
   Disclaimer : I'm not sure if they are related, but since I don't understand 
how to fix this failing test below, I dunno...
   
   Basically, you can't call `from_avro_datum` multiple times on the same 
reader :
   
   ```rust
   #[test]
       fn test_from_avro_datum_multiple() {
           let schema = Schema::parse_str(SCHEMA).unwrap();
           let mut encoded: &'static [u8] = &[54, 6, 102, 111, 111];
   
           let mut record = Record::new(&schema).unwrap();
           record.put("a", 27i64);
           record.put("b", "foo");
           let expected = record.into();
   
           from_avro_datum(&schema, &mut encoded, None).unwrap();
   
           assert_eq!(
               from_avro_datum(&schema, &mut encoded, None).unwrap(),
               expected
           );
   ```
   
   Gives
   
   ```
   thread 'reader::tests::test_from_avro_datum_multiple' panicked at 'called 
`Result::unwrap()` on an `Err` value: ReadVariableIntegerBytes(Error { kind: 
UnexpectedEof, message: "failed to fill whole buffer" })', src/reader.rs:408:54
   ```


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