Macro assertx::assert_same_variant [−][src]
macro_rules! assert_same_variant { ($left:expr, $right:expr) => { ... }; }
Asserts that actual variant is the same as the expected variant, regardless of the value of their fields. The enum is required to implement the Debug trait.
Usage
assert_same_variant!(actual, expected);
Examples
Will succeed, both variants are the same
assert_same_variant!(TestEnum::A, TestEnum::A)
Will succeed, both variants are the same even if the fields aren’t.
assert_same_variant!(TestEnum::A(2), TestEnum::A(6))
Will fail, actual variant differs from the expectation
ⓘ
assert_same_variant!(TestEnum::B, TestEnum::A)