Skip to content

Commit e2605b4

Browse files
committed
Rename #[should_fail] to #[should_panic]
1 parent 2574009 commit e2605b4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+136
-128
lines changed

src/compiletest/compiletest.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ pub fn make_test<F>(config: &Config, testfile: &Path, f: F) -> test::TestDescAnd
332332
desc: test::TestDesc {
333333
name: make_test_name(config, testfile),
334334
ignore: header::is_test_ignored(config, testfile),
335-
should_fail: test::ShouldFail::No,
335+
should_panic: test::ShouldPanic::No,
336336
},
337337
testfn: f(),
338338
}

src/libarena/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ fn test_arena_destructors() {
323323
}
324324

325325
#[test]
326-
#[should_fail]
326+
#[should_panic]
327327
fn test_arena_destructors_fail() {
328328
let arena = Arena::new();
329329
// Put some stuff in the arena.

src/libcollections/enum_set.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ mod test {
490490
}
491491

492492
#[test]
493-
#[should_fail]
493+
#[should_panic]
494494
fn test_overflow() {
495495
#[allow(dead_code)]
496496
#[derive(Copy)]

src/libcollections/slice.rs

+13-13
Original file line numberDiff line numberDiff line change
@@ -1647,14 +1647,14 @@ mod tests {
16471647
}
16481648

16491649
#[test]
1650-
#[should_fail]
1650+
#[should_panic]
16511651
fn test_tail_empty() {
16521652
let a = Vec::<i32>::new();
16531653
a.tail();
16541654
}
16551655

16561656
#[test]
1657-
#[should_fail]
1657+
#[should_panic]
16581658
fn test_tail_mut_empty() {
16591659
let mut a = Vec::<i32>::new();
16601660
a.tail_mut();
@@ -1681,14 +1681,14 @@ mod tests {
16811681
}
16821682

16831683
#[test]
1684-
#[should_fail]
1684+
#[should_panic]
16851685
fn test_init_empty() {
16861686
let a = Vec::<i32>::new();
16871687
a.init();
16881688
}
16891689

16901690
#[test]
1691-
#[should_fail]
1691+
#[should_panic]
16921692
fn test_init_mut_empty() {
16931693
let mut a = Vec::<i32>::new();
16941694
a.init_mut();
@@ -1790,7 +1790,7 @@ mod tests {
17901790
}
17911791

17921792
#[test]
1793-
#[should_fail]
1793+
#[should_panic]
17941794
fn test_swap_remove_fail() {
17951795
let mut v = vec![1];
17961796
let _ = v.swap_remove(0);
@@ -2205,7 +2205,7 @@ mod tests {
22052205
}
22062206

22072207
#[test]
2208-
#[should_fail]
2208+
#[should_panic]
22092209
fn test_insert_oob() {
22102210
let mut a = vec![1, 2, 3];
22112211
a.insert(4, 5);
@@ -2229,7 +2229,7 @@ mod tests {
22292229
}
22302230

22312231
#[test]
2232-
#[should_fail]
2232+
#[should_panic]
22332233
fn test_remove_fail() {
22342234
let mut a = vec![1];
22352235
let _ = a.remove(0);
@@ -2253,7 +2253,7 @@ mod tests {
22532253
}
22542254

22552255
#[test]
2256-
#[should_fail]
2256+
#[should_panic]
22572257
fn test_permute_fail() {
22582258
let v: [(Box<_>, Rc<_>); 4] =
22592259
[(box 0, Rc::new(0)), (box 0, Rc::new(0)),
@@ -2528,7 +2528,7 @@ mod tests {
25282528
}
25292529

25302530
#[test]
2531-
#[should_fail]
2531+
#[should_panic]
25322532
fn test_windowsator_0() {
25332533
let v = &[1,2,3,4];
25342534
let _it = v.windows(0);
@@ -2564,7 +2564,7 @@ mod tests {
25642564
}
25652565

25662566
#[test]
2567-
#[should_fail]
2567+
#[should_panic]
25682568
fn test_chunksator_0() {
25692569
let v = &[1,2,3,4];
25702570
let _it = v.chunks(0);
@@ -2647,7 +2647,7 @@ mod tests {
26472647
}
26482648

26492649
#[test]
2650-
#[should_fail]
2650+
#[should_panic]
26512651
fn test_overflow_does_not_cause_segfault() {
26522652
let mut v = vec![];
26532653
v.reserve_exact(-1);
@@ -2656,7 +2656,7 @@ mod tests {
26562656
}
26572657

26582658
#[test]
2659-
#[should_fail]
2659+
#[should_panic]
26602660
fn test_overflow_does_not_cause_segfault_managed() {
26612661
let mut v = vec![Rc::new(1)];
26622662
v.reserve_exact(-1);
@@ -2833,7 +2833,7 @@ mod tests {
28332833
}
28342834

28352835
#[test]
2836-
#[should_fail]
2836+
#[should_panic]
28372837
fn test_mut_chunks_0() {
28382838
let mut v = [1, 2, 3, 4];
28392839
let _it = v.chunks_mut(0);

src/libcollections/str.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1877,7 +1877,7 @@ mod tests {
18771877
}
18781878

18791879
#[test]
1880-
#[should_fail]
1880+
#[should_panic]
18811881
fn test_slice_fail() {
18821882
"中华Việt Nam".slice(0, 2);
18831883
}
@@ -2095,7 +2095,7 @@ mod tests {
20952095
}
20962096

20972097
#[test]
2098-
#[should_fail]
2098+
#[should_panic]
20992099
fn test_as_bytes_fail() {
21002100
// Don't double free. (I'm not sure if this exercises the
21012101
// original problem code path anymore.)
@@ -2132,7 +2132,7 @@ mod tests {
21322132
}
21332133

21342134
#[test]
2135-
#[should_fail]
2135+
#[should_panic]
21362136
fn test_subslice_offset_2() {
21372137
let a = "alchemiter";
21382138
let b = "cruxtruder";

src/libcollections/string.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1232,14 +1232,14 @@ mod tests {
12321232
}
12331233

12341234
#[test]
1235-
#[should_fail]
1235+
#[should_panic]
12361236
fn test_str_truncate_invalid_len() {
12371237
let mut s = String::from_str("12345");
12381238
s.truncate(6);
12391239
}
12401240

12411241
#[test]
1242-
#[should_fail]
1242+
#[should_panic]
12431243
fn test_str_truncate_split_codepoint() {
12441244
let mut s = String::from_str("\u{FC}"); // ü
12451245
s.truncate(1);
@@ -1272,7 +1272,7 @@ mod tests {
12721272
assert_eq!(s, "ไทย中华Vit Nam; foobar");
12731273
}
12741274

1275-
#[test] #[should_fail]
1275+
#[test] #[should_panic]
12761276
fn remove_bad() {
12771277
"ศ".to_string().remove(1);
12781278
}
@@ -1286,8 +1286,8 @@ mod tests {
12861286
assert_eq!(s, "ệfooยbar");
12871287
}
12881288

1289-
#[test] #[should_fail] fn insert_bad1() { "".to_string().insert(1, 't'); }
1290-
#[test] #[should_fail] fn insert_bad2() { "ệ".to_string().insert(1, 't'); }
1289+
#[test] #[should_panic] fn insert_bad1() { "".to_string().insert(1, 't'); }
1290+
#[test] #[should_panic] fn insert_bad2() { "ệ".to_string().insert(1, 't'); }
12911291

12921292
#[test]
12931293
fn test_slicing() {

src/libcollections/vec.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -2242,7 +2242,7 @@ mod tests {
22422242
}
22432243

22442244
#[test]
2245-
#[should_fail]
2245+
#[should_panic]
22462246
fn test_vec_truncate_fail() {
22472247
struct BadElem(i32);
22482248
impl Drop for BadElem {
@@ -2265,49 +2265,49 @@ mod tests {
22652265
}
22662266

22672267
#[test]
2268-
#[should_fail]
2268+
#[should_panic]
22692269
fn test_index_out_of_bounds() {
22702270
let vec = vec![1, 2, 3];
22712271
let _ = vec[3];
22722272
}
22732273

22742274
#[test]
2275-
#[should_fail]
2275+
#[should_panic]
22762276
fn test_slice_out_of_bounds_1() {
22772277
let x = vec![1, 2, 3, 4, 5];
22782278
&x[-1..];
22792279
}
22802280

22812281
#[test]
2282-
#[should_fail]
2282+
#[should_panic]
22832283
fn test_slice_out_of_bounds_2() {
22842284
let x = vec![1, 2, 3, 4, 5];
22852285
&x[..6];
22862286
}
22872287

22882288
#[test]
2289-
#[should_fail]
2289+
#[should_panic]
22902290
fn test_slice_out_of_bounds_3() {
22912291
let x = vec![1, 2, 3, 4, 5];
22922292
&x[-1..4];
22932293
}
22942294

22952295
#[test]
2296-
#[should_fail]
2296+
#[should_panic]
22972297
fn test_slice_out_of_bounds_4() {
22982298
let x = vec![1, 2, 3, 4, 5];
22992299
&x[1..6];
23002300
}
23012301

23022302
#[test]
2303-
#[should_fail]
2303+
#[should_panic]
23042304
fn test_slice_out_of_bounds_5() {
23052305
let x = vec![1, 2, 3, 4, 5];
23062306
&x[3..2];
23072307
}
23082308

23092309
#[test]
2310-
#[should_fail]
2310+
#[should_panic]
23112311
fn test_swap_remove_empty() {
23122312
let mut vec= Vec::<i32>::new();
23132313
vec.swap_remove(0);
@@ -2326,7 +2326,7 @@ mod tests {
23262326
}
23272327

23282328
#[test]
2329-
#[should_fail]
2329+
#[should_panic]
23302330
fn test_map_in_place_incompatible_types_fail() {
23312331
let v = vec![0, 1, 2];
23322332
v.map_in_place(|_| ());

src/libcollections/vec_deque.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1884,7 +1884,7 @@ mod tests {
18841884
}
18851885

18861886
#[test]
1887-
#[should_fail]
1887+
#[should_panic]
18881888
fn test_index_out_of_bounds() {
18891889
let mut deq = VecDeque::new();
18901890
for i in 1..4 {

src/libcollections/vec_map.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1432,7 +1432,7 @@ mod test_map {
14321432
}
14331433

14341434
#[test]
1435-
#[should_fail]
1435+
#[should_panic]
14361436
fn test_index_nonexistent() {
14371437
let mut map = VecMap::new();
14381438

src/libcoretest/cell.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ fn double_borrow_single_release_no_borrow_mut() {
109109
}
110110

111111
#[test]
112-
#[should_fail]
112+
#[should_panic]
113113
fn discard_doesnt_unborrow() {
114114
let x = RefCell::new(0);
115115
let _b = x.borrow();

src/libcoretest/finally.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ fn test_success() {
3030
}
3131

3232
#[test]
33-
#[should_fail]
33+
#[should_panic]
3434
fn test_fail() {
3535
let mut i = 0;
3636
try_finally(

src/libcoretest/fmt/num.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ fn test_format_radix() {
161161
}
162162

163163
#[test]
164-
#[should_fail]
164+
#[should_panic]
165165
fn test_radix_base_too_large() {
166166
let _ = radix(55, 37);
167167
}

src/libcoretest/iter.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ fn test_rposition() {
581581
}
582582

583583
#[test]
584-
#[should_fail]
584+
#[should_panic]
585585
fn test_rposition_panic() {
586586
let v: [(Box<_>, Box<_>); 4] =
587587
[(box 0, box 0), (box 0, box 0),

src/libcoretest/option.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ fn test_option_dance() {
8080
assert!(y.is_none());
8181
}
8282

83-
#[test] #[should_fail]
83+
#[test] #[should_panic]
8484
fn test_option_too_much_dance() {
8585
let mut y = Some(marker::NoCopy);
8686
let _y2 = y.take().unwrap();
@@ -139,14 +139,14 @@ fn test_unwrap() {
139139
}
140140

141141
#[test]
142-
#[should_fail]
142+
#[should_panic]
143143
fn test_unwrap_panic1() {
144144
let x: Option<int> = None;
145145
x.unwrap();
146146
}
147147

148148
#[test]
149-
#[should_fail]
149+
#[should_panic]
150150
fn test_unwrap_panic2() {
151151
let x: Option<String> = None;
152152
x.unwrap();

src/libcoretest/result.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ pub fn test_unwrap_or_else() {
126126
}
127127

128128
#[test]
129-
#[should_fail]
129+
#[should_panic]
130130
pub fn test_unwrap_or_else_panic() {
131131
fn handler(msg: &'static str) -> int {
132132
if msg == "I got this." {

src/librand/distributions/exponential.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,12 @@ mod test {
109109
}
110110
}
111111
#[test]
112-
#[should_fail]
112+
#[should_panic]
113113
fn test_exp_invalid_lambda_zero() {
114114
Exp::new(0.0);
115115
}
116116
#[test]
117-
#[should_fail]
117+
#[should_panic]
118118
fn test_exp_invalid_lambda_neg() {
119119
Exp::new(-10.0);
120120
}

src/librand/distributions/gamma.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ mod test {
356356
}
357357
}
358358
#[test]
359-
#[should_fail]
359+
#[should_panic]
360360
fn test_chi_squared_invalid_dof() {
361361
ChiSquared::new(-1.0);
362362
}

0 commit comments

Comments
 (0)