diff options
Diffstat (limited to 'third_party/rust/bitflags/src/tests/empty.rs')
-rw-r--r-- | third_party/rust/bitflags/src/tests/empty.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/third_party/rust/bitflags/src/tests/empty.rs b/third_party/rust/bitflags/src/tests/empty.rs new file mode 100644 index 0000000000..57fb1c7cf1 --- /dev/null +++ b/third_party/rust/bitflags/src/tests/empty.rs @@ -0,0 +1,23 @@ +use super::*; + +use crate::Flags; + +#[test] +fn cases() { + case(0, TestFlags::empty); + + case(0, TestZero::empty); + + case(0, TestEmpty::empty); + + case(0, TestExternal::empty); +} + +#[track_caller] +fn case<T: Flags>(expected: T::Bits, inherent: impl FnOnce() -> T) +where + <T as Flags>::Bits: std::fmt::Debug + PartialEq, +{ + assert_eq!(expected, inherent().bits(), "T::empty()"); + assert_eq!(expected, T::empty().bits(), "Flags::empty()"); +} |