Skip to content

Rename #[should_fail] to #[should_panic] #21824

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 9, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/compiletest/compiletest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ pub fn make_test<F>(config: &Config, testfile: &Path, f: F) -> test::TestDescAnd
desc: test::TestDesc {
name: make_test_name(config, testfile),
ignore: header::is_test_ignored(config, testfile),
should_fail: test::ShouldFail::No,
should_panic: test::ShouldPanic::No,
},
testfn: f(),
}
Expand Down
2 changes: 1 addition & 1 deletion src/libarena/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ fn test_arena_destructors() {
}

#[test]
#[should_fail]
#[should_panic]
fn test_arena_destructors_fail() {
let arena = Arena::new();
// Put some stuff in the arena.
Expand Down
2 changes: 1 addition & 1 deletion src/libcollections/enum_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ mod test {
}

#[test]
#[should_fail]
#[should_panic]
fn test_overflow() {
#[allow(dead_code)]
#[derive(Copy)]
Expand Down
26 changes: 13 additions & 13 deletions src/libcollections/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1647,14 +1647,14 @@ mod tests {
}

#[test]
#[should_fail]
#[should_panic]
fn test_tail_empty() {
let a = Vec::<i32>::new();
a.tail();
}

#[test]
#[should_fail]
#[should_panic]
fn test_tail_mut_empty() {
let mut a = Vec::<i32>::new();
a.tail_mut();
Expand All @@ -1681,14 +1681,14 @@ mod tests {
}

#[test]
#[should_fail]
#[should_panic]
fn test_init_empty() {
let a = Vec::<i32>::new();
a.init();
}

#[test]
#[should_fail]
#[should_panic]
fn test_init_mut_empty() {
let mut a = Vec::<i32>::new();
a.init_mut();
Expand Down Expand Up @@ -1790,7 +1790,7 @@ mod tests {
}

#[test]
#[should_fail]
#[should_panic]
fn test_swap_remove_fail() {
let mut v = vec![1];
let _ = v.swap_remove(0);
Expand Down Expand Up @@ -2205,7 +2205,7 @@ mod tests {
}

#[test]
#[should_fail]
#[should_panic]
fn test_insert_oob() {
let mut a = vec![1, 2, 3];
a.insert(4, 5);
Expand All @@ -2229,7 +2229,7 @@ mod tests {
}

#[test]
#[should_fail]
#[should_panic]
fn test_remove_fail() {
let mut a = vec![1];
let _ = a.remove(0);
Expand All @@ -2253,7 +2253,7 @@ mod tests {
}

#[test]
#[should_fail]
#[should_panic]
fn test_permute_fail() {
let v: [(Box<_>, Rc<_>); 4] =
[(box 0, Rc::new(0)), (box 0, Rc::new(0)),
Expand Down Expand Up @@ -2528,7 +2528,7 @@ mod tests {
}

#[test]
#[should_fail]
#[should_panic]
fn test_windowsator_0() {
let v = &[1,2,3,4];
let _it = v.windows(0);
Expand Down Expand Up @@ -2564,7 +2564,7 @@ mod tests {
}

#[test]
#[should_fail]
#[should_panic]
fn test_chunksator_0() {
let v = &[1,2,3,4];
let _it = v.chunks(0);
Expand Down Expand Up @@ -2647,7 +2647,7 @@ mod tests {
}

#[test]
#[should_fail]
#[should_panic]
fn test_overflow_does_not_cause_segfault() {
let mut v = vec![];
v.reserve_exact(-1);
Expand All @@ -2656,7 +2656,7 @@ mod tests {
}

#[test]
#[should_fail]
#[should_panic]
fn test_overflow_does_not_cause_segfault_managed() {
let mut v = vec![Rc::new(1)];
v.reserve_exact(-1);
Expand Down Expand Up @@ -2833,7 +2833,7 @@ mod tests {
}

#[test]
#[should_fail]
#[should_panic]
fn test_mut_chunks_0() {
let mut v = [1, 2, 3, 4];
let _it = v.chunks_mut(0);
Expand Down
6 changes: 3 additions & 3 deletions src/libcollections/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1877,7 +1877,7 @@ mod tests {
}

#[test]
#[should_fail]
#[should_panic]
fn test_slice_fail() {
"中华Việt Nam".slice(0, 2);
}
Expand Down Expand Up @@ -2095,7 +2095,7 @@ mod tests {
}

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

#[test]
#[should_fail]
#[should_panic]
fn test_subslice_offset_2() {
let a = "alchemiter";
let b = "cruxtruder";
Expand Down
10 changes: 5 additions & 5 deletions src/libcollections/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1232,14 +1232,14 @@ mod tests {
}

#[test]
#[should_fail]
#[should_panic]
fn test_str_truncate_invalid_len() {
let mut s = String::from_str("12345");
s.truncate(6);
}

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

#[test] #[should_fail]
#[test] #[should_panic]
fn remove_bad() {
"ศ".to_string().remove(1);
}
Expand All @@ -1286,8 +1286,8 @@ mod tests {
assert_eq!(s, "ệfooยbar");
}

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

#[test]
fn test_slicing() {
Expand Down
18 changes: 9 additions & 9 deletions src/libcollections/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2242,7 +2242,7 @@ mod tests {
}

#[test]
#[should_fail]
#[should_panic]
fn test_vec_truncate_fail() {
struct BadElem(i32);
impl Drop for BadElem {
Expand All @@ -2265,49 +2265,49 @@ mod tests {
}

#[test]
#[should_fail]
#[should_panic]
fn test_index_out_of_bounds() {
let vec = vec![1, 2, 3];
let _ = vec[3];
}

#[test]
#[should_fail]
#[should_panic]
fn test_slice_out_of_bounds_1() {
let x = vec![1, 2, 3, 4, 5];
&x[-1..];
}

#[test]
#[should_fail]
#[should_panic]
fn test_slice_out_of_bounds_2() {
let x = vec![1, 2, 3, 4, 5];
&x[..6];
}

#[test]
#[should_fail]
#[should_panic]
fn test_slice_out_of_bounds_3() {
let x = vec![1, 2, 3, 4, 5];
&x[-1..4];
}

#[test]
#[should_fail]
#[should_panic]
fn test_slice_out_of_bounds_4() {
let x = vec![1, 2, 3, 4, 5];
&x[1..6];
}

#[test]
#[should_fail]
#[should_panic]
fn test_slice_out_of_bounds_5() {
let x = vec![1, 2, 3, 4, 5];
&x[3..2];
}

#[test]
#[should_fail]
#[should_panic]
fn test_swap_remove_empty() {
let mut vec= Vec::<i32>::new();
vec.swap_remove(0);
Expand All @@ -2326,7 +2326,7 @@ mod tests {
}

#[test]
#[should_fail]
#[should_panic]
fn test_map_in_place_incompatible_types_fail() {
let v = vec![0, 1, 2];
v.map_in_place(|_| ());
Expand Down
2 changes: 1 addition & 1 deletion src/libcollections/vec_deque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1884,7 +1884,7 @@ mod tests {
}

#[test]
#[should_fail]
#[should_panic]
fn test_index_out_of_bounds() {
let mut deq = VecDeque::new();
for i in 1..4 {
Expand Down
2 changes: 1 addition & 1 deletion src/libcollections/vec_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1432,7 +1432,7 @@ mod test_map {
}

#[test]
#[should_fail]
#[should_panic]
fn test_index_nonexistent() {
let mut map = VecMap::new();

Expand Down
2 changes: 1 addition & 1 deletion src/libcoretest/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ fn double_borrow_single_release_no_borrow_mut() {
}

#[test]
#[should_fail]
#[should_panic]
fn discard_doesnt_unborrow() {
let x = RefCell::new(0);
let _b = x.borrow();
Expand Down
2 changes: 1 addition & 1 deletion src/libcoretest/finally.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fn test_success() {
}

#[test]
#[should_fail]
#[should_panic]
fn test_fail() {
let mut i = 0;
try_finally(
Expand Down
2 changes: 1 addition & 1 deletion src/libcoretest/fmt/num.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ fn test_format_radix() {
}

#[test]
#[should_fail]
#[should_panic]
fn test_radix_base_too_large() {
let _ = radix(55, 37);
}
Expand Down
2 changes: 1 addition & 1 deletion src/libcoretest/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ fn test_rposition() {
}

#[test]
#[should_fail]
#[should_panic]
fn test_rposition_panic() {
let v: [(Box<_>, Box<_>); 4] =
[(box 0, box 0), (box 0, box 0),
Expand Down
6 changes: 3 additions & 3 deletions src/libcoretest/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ fn test_option_dance() {
assert!(y.is_none());
}

#[test] #[should_fail]
#[test] #[should_panic]
fn test_option_too_much_dance() {
let mut y = Some(marker::NoCopy);
let _y2 = y.take().unwrap();
Expand Down Expand Up @@ -139,14 +139,14 @@ fn test_unwrap() {
}

#[test]
#[should_fail]
#[should_panic]
fn test_unwrap_panic1() {
let x: Option<int> = None;
x.unwrap();
}

#[test]
#[should_fail]
#[should_panic]
fn test_unwrap_panic2() {
let x: Option<String> = None;
x.unwrap();
Expand Down
2 changes: 1 addition & 1 deletion src/libcoretest/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ pub fn test_unwrap_or_else() {
}

#[test]
#[should_fail]
#[should_panic]
pub fn test_unwrap_or_else_panic() {
fn handler(msg: &'static str) -> int {
if msg == "I got this." {
Expand Down
4 changes: 2 additions & 2 deletions src/librand/distributions/exponential.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@ mod test {
}
}
#[test]
#[should_fail]
#[should_panic]
fn test_exp_invalid_lambda_zero() {
Exp::new(0.0);
}
#[test]
#[should_fail]
#[should_panic]
fn test_exp_invalid_lambda_neg() {
Exp::new(-10.0);
}
Expand Down
2 changes: 1 addition & 1 deletion src/librand/distributions/gamma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ mod test {
}
}
#[test]
#[should_fail]
#[should_panic]
fn test_chi_squared_invalid_dof() {
ChiSquared::new(-1.0);
}
Expand Down
Loading