Skip to content

Commit

Permalink
Move const tests for Ordering to library\core
Browse files Browse the repository at this point in the history
Part of #76268
  • Loading branch information
CDirkx committed Sep 3, 2020
1 parent ea5dc09 commit 79d563c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
18 changes: 17 additions & 1 deletion library/core/tests/cmp.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
use core::cmp::{self, Ordering::*};
use core::cmp::{
self,
Ordering::{self, *},
};

#[test]
fn test_int_totalord() {
Expand Down Expand Up @@ -116,3 +119,16 @@ fn test_user_defined_eq() {
assert!(SketchyNum { num: 37 } == SketchyNum { num: 34 });
assert!(SketchyNum { num: 25 } != SketchyNum { num: 57 });
}

#[test]
fn ordering_const() {
// test that the methods of `Ordering` are usable in a const context

const ORDERING: Ordering = Greater;

const REVERSE: Ordering = ORDERING.reverse();
assert_eq!(REVERSE, Less);

const THEN: Ordering = Equal.then(ORDERING);
assert_eq!(THEN, Greater);
}
15 changes: 0 additions & 15 deletions src/test/ui/consts/const-ordering.rs

This file was deleted.

0 comments on commit 79d563c

Please sign in to comment.