diff options
| author | Zachary S <zasample18+github@gmail.com> | 2022-03-16 14:01:48 -0500 |
|---|---|---|
| committer | Zachary S <zasample18+github@gmail.com> | 2022-03-16 14:01:48 -0500 |
| commit | b13b495b918026fc5f3bf059bbde19c832ffe3c0 (patch) | |
| tree | c254f3bbe633fb3d3706f64afb7345005e826e79 | |
| parent | ba611d55f39909f4c4da43fe96a275c4746c38d1 (diff) | |
| download | rust-b13b495b918026fc5f3bf059bbde19c832ffe3c0.tar.gz rust-b13b495b918026fc5f3bf059bbde19c832ffe3c0.zip | |
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.
| -rw-r--r-- | library/core/tests/cmp.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/library/core/tests/cmp.rs b/library/core/tests/cmp.rs index 2b234de6795..8d0e59d5a49 100644 --- a/library/core/tests/cmp.rs +++ b/library/core/tests/cmp.rs @@ -134,6 +134,19 @@ fn ordering_const() { } #[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 |
