This is an automated email from the ASF dual-hosted git repository.

kriskras99 pushed a commit to branch 
fix/test_overflow_doesnt_test_the_right_thing
in repository https://gitbox.apache.org/repos/asf/avro-rs.git

commit 23b60341b78a2c7f746ee575fbe875061a626d58
Author: Kriskras99 <[email protected]>
AuthorDate: Fri Dec 5 17:32:10 2025 +0100

    fix: `test_overflow` doesn't test for overflow
    
    The test still "worked" because an error was still returned, but the
    error was the `ReadVariableIntegerBytes`.
---
 avro/src/util.rs | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/avro/src/util.rs b/avro/src/util.rs
index ba319d3..748e923 100644
--- a/avro/src/util.rs
+++ b/avro/src/util.rs
@@ -296,8 +296,13 @@ mod tests {
 
     #[test]
     fn test_overflow() {
-        let causes_left_shift_overflow: &[u8] = &[0xe1, 0xe1, 0xe1, 0xe1, 
0xe1];
-        assert!(decode_variable(&mut &*causes_left_shift_overflow).is_err());
+        let causes_left_shift_overflow: &[u8] = &[0xe1; 10];
+        assert!(matches!(
+            decode_variable(&mut &*causes_left_shift_overflow)
+                .unwrap_err()
+                .details(),
+            Details::IntegerOverflow
+        ));
     }
 
     #[test]

Reply via email to