Skip to content

Commit 8b6802c

Browse files
committed
Improve core::result coverage
1 parent a1c452d commit 8b6802c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

library/coretests/tests/result.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,18 @@ fn test_or_else() {
4444
assert_eq!(op2().or_else(|e| Err::<isize, &'static str>(e)).unwrap_err(), "sadface");
4545
}
4646

47+
#[test]
48+
fn test_map_or() {
49+
assert_eq!(op1().map_or(667, |x| x), 666);
50+
assert_eq!(op2().map_or(666, |_| panic!()), 666);
51+
}
52+
53+
#[test]
54+
fn test_copied() {
55+
assert!(Ok::<&isize, isize>(&1).copied() == Ok(1));
56+
assert!(Err::<&isize, isize>(1).copied() == Err(1));
57+
}
58+
4759
#[test]
4860
fn test_impl_map() {
4961
assert!(Ok::<isize, isize>(1).map(|x| x + 1) == Ok(2));

0 commit comments

Comments
 (0)