Skip to content

Commit 62bd19f

Browse files
committed
rollup merge of #24929: tamird/unstub-some-tests
r? @alexcrichton
2 parents b9b1312 + f7947bc commit 62bd19f

File tree

2 files changed

+19
-24
lines changed

2 files changed

+19
-24
lines changed

src/libcoretest/option.rs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,6 @@ fn test_ord() {
219219
assert!(big > None);
220220
}
221221

222-
/* FIXME(#20575)
223222
#[test]
224223
fn test_collect() {
225224
let v: Option<Vec<isize>> = (0..0).map(|_| Some(0)).collect();
@@ -241,28 +240,26 @@ fn test_collect() {
241240

242241
assert!(v == None);
243242
}
244-
*/
243+
245244

246245
#[test]
247246
fn test_cloned() {
248-
let val1 = 1u32;
249-
let mut val2 = 2u32;
250-
let val1_ref = &val1;
247+
let val = 1u32;
248+
let val_ref = &val;
251249
let opt_none: Option<&'static u32> = None;
252-
let opt_ref = Some(&val1);
253-
let opt_ref_ref = Some(&val1_ref);
254-
let opt_mut_ref = Some(&mut val2);
250+
let opt_ref = Some(&val);
251+
let opt_ref_ref = Some(&val_ref);
255252

256253
// None works
257254
assert_eq!(opt_none.clone(), None);
258255
assert_eq!(opt_none.cloned(), None);
259256

260257
// Immutable ref works
261-
assert_eq!(opt_ref.clone(), Some(&val1));
258+
assert_eq!(opt_ref.clone(), Some(&val));
262259
assert_eq!(opt_ref.cloned(), Some(1u32));
263260

264261
// Double Immutable ref works
265-
assert_eq!(opt_ref_ref.clone(), Some(&val1_ref));
266-
assert_eq!(opt_ref_ref.clone().cloned(), Some(&val1));
262+
assert_eq!(opt_ref_ref.clone(), Some(&val_ref));
263+
assert_eq!(opt_ref_ref.clone().cloned(), Some(&val));
267264
assert_eq!(opt_ref_ref.cloned().cloned(), Some(1u32));
268265
}

src/libcoretest/result.rs

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
pub fn op1() -> Result<isize, &'static str> { Ok(666) }
12-
pub fn op2() -> Result<isize, &'static str> { Err("sadface") }
11+
fn op1() -> Result<isize, &'static str> { Ok(666) }
12+
fn op2() -> Result<isize, &'static str> { Err("sadface") }
1313

1414
#[test]
15-
pub fn test_and() {
15+
fn test_and() {
1616
assert_eq!(op1().and(Ok(667)).unwrap(), 667);
1717
assert_eq!(op1().and(Err::<i32, &'static str>("bad")).unwrap_err(),
1818
"bad");
@@ -23,7 +23,7 @@ pub fn test_and() {
2323
}
2424

2525
#[test]
26-
pub fn test_and_then() {
26+
fn test_and_then() {
2727
assert_eq!(op1().and_then(|i| Ok::<isize, &'static str>(i + 1)).unwrap(), 667);
2828
assert_eq!(op1().and_then(|_| Err::<isize, &'static str>("bad")).unwrap_err(),
2929
"bad");
@@ -35,7 +35,7 @@ pub fn test_and_then() {
3535
}
3636

3737
#[test]
38-
pub fn test_or() {
38+
fn test_or() {
3939
assert_eq!(op1().or(Ok::<_, &'static str>(667)).unwrap(), 666);
4040
assert_eq!(op1().or(Err("bad")).unwrap(), 666);
4141

@@ -44,7 +44,7 @@ pub fn test_or() {
4444
}
4545

4646
#[test]
47-
pub fn test_or_else() {
47+
fn test_or_else() {
4848
assert_eq!(op1().or_else(|_| Ok::<isize, &'static str>(667)).unwrap(), 666);
4949
assert_eq!(op1().or_else(|e| Err::<isize, &'static str>(e)).unwrap(), 666);
5050

@@ -54,18 +54,17 @@ pub fn test_or_else() {
5454
}
5555

5656
#[test]
57-
pub fn test_impl_map() {
57+
fn test_impl_map() {
5858
assert!(Ok::<isize, isize>(1).map(|x| x + 1) == Ok(2));
5959
assert!(Err::<isize, isize>(1).map(|x| x + 1) == Err(1));
6060
}
6161

6262
#[test]
63-
pub fn test_impl_map_err() {
63+
fn test_impl_map_err() {
6464
assert!(Ok::<isize, isize>(1).map_err(|x| x + 1) == Ok(1));
6565
assert!(Err::<isize, isize>(1).map_err(|x| x + 1) == Err(2));
6666
}
6767

68-
/* FIXME(#20575)
6968
#[test]
7069
fn test_collect() {
7170
let v: Result<Vec<isize>, ()> = (0..0).map(|_| Ok::<isize, ()>(0)).collect();
@@ -86,10 +85,9 @@ fn test_collect() {
8685
let v: Result<Vec<()>, isize> = functions.iter_mut().map(|f| (*f)()).collect();
8786
assert!(v == Err(1));
8887
}
89-
*/
9088

9189
#[test]
92-
pub fn test_fmt_default() {
90+
fn test_fmt_default() {
9391
let ok: Result<isize, &'static str> = Ok(100);
9492
let err: Result<isize, &'static str> = Err("Err");
9593

@@ -100,7 +98,7 @@ pub fn test_fmt_default() {
10098
}
10199

102100
#[test]
103-
pub fn test_unwrap_or() {
101+
fn test_unwrap_or() {
104102
let ok: Result<isize, &'static str> = Ok(100);
105103
let ok_err: Result<isize, &'static str> = Err("Err");
106104

@@ -109,7 +107,7 @@ pub fn test_unwrap_or() {
109107
}
110108

111109
#[test]
112-
pub fn test_unwrap_or_else() {
110+
fn test_unwrap_or_else() {
113111
fn handler(msg: &'static str) -> isize {
114112
if msg == "I got this." {
115113
50

0 commit comments

Comments
 (0)