Vendor things
This commit is contained in:
parent
5deceec006
commit
977e3c17e5
19434 changed files with 10682014 additions and 0 deletions
22
third-party/vendor/num_enum-0.5.11/tests/unsafe_from_primitive.rs
vendored
Normal file
22
third-party/vendor/num_enum-0.5.11/tests/unsafe_from_primitive.rs
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
use ::num_enum::UnsafeFromPrimitive;
|
||||
|
||||
// Guard against https://github.com/illicitonion/num_enum/issues/27
|
||||
mod alloc {}
|
||||
mod core {}
|
||||
mod num_enum {}
|
||||
mod std {}
|
||||
|
||||
#[test]
|
||||
fn has_unsafe_from_primitive_number() {
|
||||
#[derive(Debug, Eq, PartialEq, UnsafeFromPrimitive)]
|
||||
#[repr(u8)]
|
||||
enum Enum {
|
||||
Zero,
|
||||
One,
|
||||
}
|
||||
|
||||
unsafe {
|
||||
assert_eq!(Enum::from_unchecked(0_u8), Enum::Zero);
|
||||
assert_eq!(Enum::from_unchecked(1_u8), Enum::One);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue