8 lines
205 B
Rust
Raw Normal View History

2019-09-07 15:49:27 +01:00
#[test]
fn test_bool_to_option() {
2019-12-06 12:18:32 +00:00
assert_eq!(false.then_some(0), None);
assert_eq!(true.then_some(0), Some(0));
assert_eq!(false.then(|| 0), None);
assert_eq!(true.then(|| 0), Some(0));
2019-09-07 15:49:27 +01:00
}