tests/issues/issue_498.rs
raw| 1 | #![cfg(feature = "std")] |
| 2 | |
| 3 | extern crate std; |
| 4 | |
| 5 | use std::ffi::CString; |
| 6 | |
| 7 | #[test] |
| 8 | fn test_issue_498() { |
| 9 | let bytes = [1, 0, 0, 0, 0, 0, 0, 0, 0]; |
| 10 | let out: Result<(CString, _), _> = |
| 11 | bincode::decode_from_slice(&bytes, bincode::config::legacy().with_limit::<1024>()); |
| 12 | |
| 13 | match out.unwrap_err() { |
| 14 | bincode::error::DecodeError::CStringNulError { position: _ } => {} |
| 15 | err => panic!("Expected CStringNullErr, found {:?}", err), |
| 16 | } |
| 17 | } |