Add test for StructuralEq for std::cmp::Ordering.
Added test in library/core/tests/cmp.rs that ensures that `const`s of type `Ordering`s can be used in patterns.
This commit is contained in:
parent
ba611d55f3
commit
b13b495b91
@ -133,6 +133,19 @@ fn ordering_const() {
|
||||
assert_eq!(THEN, Greater);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ordering_structural_eq() {
|
||||
// test that consts of type `Ordering` are usable in patterns
|
||||
|
||||
const ORDERING: Ordering = Greater;
|
||||
|
||||
const REVERSE: Ordering = ORDERING.reverse();
|
||||
match Ordering::Less {
|
||||
REVERSE => {}
|
||||
_ => unreachable!(),
|
||||
};
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cmp_default() {
|
||||
// Test default methods in PartialOrd and PartialEq
|
||||
|
Loading…
Reference in New Issue
Block a user