()
| 982 | |
| 983 | #[test] |
| 984 | fn non_utf8_bytes() { |
| 985 | // non-utf8 bytes |
| 986 | let bytes: &[u8] = &[0xE4, 0xBD, 0xA0, 0xE5, 0xA5, 0xBD, 0xE8, 0xAF, 0xAD]; |
| 987 | let array = BinaryArray::from(vec![Some(bytes)]); |
| 988 | let arr = substring(&array, 0, Some(5)).unwrap(); |
| 989 | let actual = arr.as_any().downcast_ref::<BinaryArray>().unwrap(); |
| 990 | |
| 991 | let expected_bytes: &[u8] = &[0xE4, 0xBD, 0xA0, 0xE5, 0xA5]; |
| 992 | let expected = BinaryArray::from(vec![Some(expected_bytes)]); |
| 993 | assert_eq!(expected, *actual); |
| 994 | } |
| 995 | } |