Skip to content

Commit 4f859fb

Browse files
committed
Move const tests for Option to library\core
Part of #76268
1 parent 9486f72 commit 4f859fb

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

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

-12
This file was deleted.

0 commit comments

Comments
 (0)