Apache DataFusion SQL Query Engine
ARROW-3177: [Rust] Update expected error messages for tests that 'should panic'
Paddy Horan816341024022
diff --git a/rust/src/array.rs b/rust/src/array.rsindex b21e6040cd..c42928f84f 100644--- a/rust/src/array.rs+++ b/rust/src/array.rs@@ -440,7 +440,7 @@ impl From<ArrayDataRef> for BinaryArray {let raw_value_offsets = data.buffers()[0].raw_data();assert!(memory::is_aligned(raw_value_offsets, mem::align_of::<i32>()),- "memory not aligned"+ "memory is not aligned");let value_data = data.buffers()[1].raw_data();Self {@@ -599,7 +599,9 @@ mod tests {}#[test]- #[should_panic(expected = "")]+ #[should_panic(+ expected = "PrimitiveArray data should contain a single buffer only (values buffer)"+ )]fn test_primitive_array_invalid_buffer_len() {let data = ArrayData::builder(DataType::Int32).len(5).build();PrimitiveArray::<i32>::from(data);@@ -657,7 +659,7 @@ mod tests {}#[test]- #[should_panic(expected = "")]+ #[should_panic(expected = "ListArray data should contain a single buffer only (value offsets)")]fn test_list_array_invalid_buffer_len() {let value_data = ArrayData::builder(DataType::Int32).len(7)@@ -672,7 +674,7 @@ mod tests {}#[test]- #[should_panic(expected = "")]+ #[should_panic(expected = "ListArray should contain a single child array (values array)")]fn test_list_array_invalid_child_array_len() {let value_offsets = Buffer::from(&[0, 2, 5, 7].to_byte_slice());let list_data_type = DataType::List(Box::new(DataType::Int32));@@ -684,7 +686,7 @@ mod tests {}#[test]- #[should_panic(expected = "")]+ #[should_panic(expected = "offsets do not start at zero")]fn test_list_array_invalid_value_offset_start() {let value_data = ArrayData::builder(DataType::Int32).len(7)@@ -703,7 +705,7 @@ mod tests {}#[test]- #[should_panic(expected = "")]+ #[should_panic(expected = "inconsistent offsets buffer and values array")]fn test_list_array_invalid_value_offset_end() {let value_data = ArrayData::builder(DataType::Int32).len(7)@@ -769,7 +771,7 @@ mod tests {}#[test]- #[should_panic(expected = "")]+ #[should_panic(expected = "BinaryArray out of bounds access")]fn test_binary_array_get_value_index_out_of_bound() {let values: [u8; 12] = [b'h', b'e', b'l', b'l', b'o', b'p', b'a', b'r', b'q', b'u', b'e', b't',@@ -808,7 +810,7 @@ mod tests {}#[test]- #[should_panic(expected = "")]+ #[should_panic(expected = "memory is not aligned")]fn test_primitive_array_alignment() {let ptr = memory::allocate_aligned(8).unwrap();let buf = Buffer::from_raw_parts(ptr, 8);@@ -818,7 +820,7 @@ mod tests {}#[test]- #[should_panic(expected = "")]+ #[should_panic(expected = "memory is not aligned")]fn test_list_array_alignment() {let ptr = memory::allocate_aligned(8).unwrap();let buf = Buffer::from_raw_parts(ptr, 8);@@ -838,7 +840,7 @@ mod tests {}#[test]- #[should_panic(expected = "")]+ #[should_panic(expected = "memory is not aligned")]fn test_binary_array_alignment() {let ptr = memory::allocate_aligned(8).unwrap();let buf = Buffer::from_raw_parts(ptr, 8);diff --git a/rust/src/buffer.rs b/rust/src/buffer.rsindex f50b19cfa0..1cad425846 100644--- a/rust/src/buffer.rs+++ b/rust/src/buffer.rs@@ -215,7 +215,7 @@ mod tests {}#[test]- #[should_panic(expected = "")]+ #[should_panic(expected = "the offset of the new Buffer cannot exceed the existing length")]fn test_slice_offset_out_of_bound() {let buf = Buffer::from(&[2, 4, 6, 8, 10]);buf.slice(6);diff --git a/rust/src/builder.rs b/rust/src/builder.rsindex 58eac4aa00..8b5438e6d0 100644--- a/rust/src/builder.rs+++ b/rust/src/builder.rs@@ -237,21 +237,21 @@ mod tests {}#[test]- #[should_panic]+ #[should_panic(expected = "the end of the slice must be within the capacity")]fn test_slice_start_out_of_bounds() {let mut b: Builder<u8> = Builder::with_capacity(2);b.slice_mut(3, 3); // should panic}#[test]- #[should_panic]+ #[should_panic(expected = "the end of the slice must be within the capacity")]fn test_slice_end_out_of_bounds() {let mut b: Builder<u8> = Builder::with_capacity(2);b.slice_mut(0, 3); // should panic}#[test]- #[should_panic]+ #[should_panic(expected = "the start of the slice cannot exceed the end of the slice")]fn test_slice_end_before_start() {let mut b: Builder<u8> = Builder::with_capacity(2);b.slice_mut(1, 0); // should panic