1
Fork 0

add test for invalid char

This commit is contained in:
Oliver Schneider 2016-06-21 09:53:26 +02:00
parent 0c720f6e6b
commit 3404a9da2a
No known key found for this signature in database
GPG key ID: 56D6EEA0FC67AC46

View file

@ -0,0 +1,8 @@
fn main() {
assert!(std::char::from_u32(-1_i32 as u32).is_none());
match unsafe { std::mem::transmute::<i32, char>(-1) } {
'a' => {}, //~ERROR tried to interpret an invalid 32-bit value as a char: 4294967295
'b' => {},
_ => {},
}
}