rust/src/libcore/tests/bool.rs

8 lines
225 B
Rust
Raw Normal View History

2019-09-07 09:49:27 -05:00
#[test]
fn test_bool_to_option() {
2019-10-08 18:48:47 -05:00
assert_eq!(false.to_option(0), None);
assert_eq!(true.to_option(0), Some(0));
assert_eq!(false.to_option_with(|| 0), None);
assert_eq!(true.to_option_with(|| 0), Some(0));
2019-09-07 09:49:27 -05:00
}