superserious-dev commented on code in PR #7779: URL: https://github.com/apache/arrow-rs/pull/7779#discussion_r2167416254
########## parquet-variant/src/decoder.rs: ########## @@ -284,157 +303,253 @@ pub(crate) fn decode_short_string(metadata: u8, data: &[u8]) -> Result<ShortStri #[cfg(test)] mod tests { use super::*; + use paste::paste; + + mod integer { + use super::*; + + macro_rules! decoder_tests { + ($test_name:ident, $data:expr, $decode_fn:ident, $expected:expr) => { + paste! { + #[test] + fn [<$test_name _exact_length>]() { + let result = $decode_fn(&$data).unwrap(); + assert_eq!(result, $expected); + } + + #[test] + fn [<$test_name _truncated_length>]() { + // Remove the last byte of data so that there is not enough to decode + let truncated_data = &$data[.. $data.len() - 1]; + let result = $decode_fn(&truncated_data); + assert!(matches!(result, Err(ArrowError::InvalidArgumentError(_)))); Review Comment: Currently only asserting the type of error rather than the String contents if the error. I'm fine with either adding a check on the String or leaving just the type check. -- 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: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org