Skip to content

Commit 04e4a39

Browse files
committed
Move const tests for Option to library\core
Part of rust-lang#76268
1 parent db109c6 commit 04e4a39

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

library/core/tests/option.rs

+16
Original file line numberDiff line numberDiff line change
@@ -357,3 +357,19 @@ fn test_replace() {
357357
assert_eq!(x, Some(3));
358358
assert_eq!(old, None);
359359
}
360+
361+
#[test]
362+
fn option_const() {
363+
// test that the methods of `Option` are usable in a const context
364+
365+
const OPTION: Option<usize> = Some(32);
366+
367+
const REF: Option<&usize> = OPTION.as_ref();
368+
assert_eq!(REF, Some(&32));
369+
370+
const IS_SOME: bool = OPTION.is_some();
371+
assert!(IS_SOME);
372+
373+
const IS_NONE: bool = OPTION.is_none();
374+
assert!(!IS_NONE);
375+
}

src/test/ui/consts/const-option.rs

-12
This file was deleted.

0 commit comments

Comments
 (0)