Skip to content

Commit

Permalink
Move const tests for Option to library\core
Browse files Browse the repository at this point in the history
  • Loading branch information
CDirkx committed Sep 3, 2020
1 parent db109c6 commit 04e4a39
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
16 changes: 16 additions & 0 deletions library/core/tests/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,3 +357,19 @@ fn test_replace() {
assert_eq!(x, Some(3));
assert_eq!(old, None);
}

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

const OPTION: Option<usize> = Some(32);

const REF: Option<&usize> = OPTION.as_ref();
assert_eq!(REF, Some(&32));

const IS_SOME: bool = OPTION.is_some();
assert!(IS_SOME);

const IS_NONE: bool = OPTION.is_none();
assert!(!IS_NONE);
}
12 changes: 0 additions & 12 deletions src/test/ui/consts/const-option.rs

This file was deleted.

0 comments on commit 04e4a39

Please sign in to comment.