fix and expand panic tests
This commit is contained in:
parent
b2cddd27bd
commit
ae53b1222a
@ -1,5 +0,0 @@
|
||||
#![allow(const_err)]
|
||||
|
||||
fn main() {
|
||||
let _n = 1 / 0; //~ ERROR attempt to divide by zero
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
#![allow(exceeding_bitshifts)]
|
||||
#![allow(const_err)]
|
||||
|
||||
fn main() {
|
||||
let _n = 2i64 << -1; //~ ERROR attempt to shift left with overflow
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
#![allow(exceeding_bitshifts, const_err)]
|
||||
|
||||
fn main() {
|
||||
let _n = 1i64 >> 64; //~ ERROR attempt to shift right with overflow
|
||||
}
|
6
tests/run-pass/panic/div-by-zero-2.rs
Normal file
6
tests/run-pass/panic/div-by-zero-2.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// ignore-windows: Unwind panicking does not currently work on Windows
|
||||
#![allow(const_err)]
|
||||
|
||||
fn main() {
|
||||
let _n = 1 / 0;
|
||||
}
|
1
tests/run-pass/panic/div-by-zero-2.stderr
Normal file
1
tests/run-pass/panic/div-by-zero-2.stderr
Normal file
@ -0,0 +1 @@
|
||||
thread 'main' panicked at 'attempt to divide by zero', $DIR/div-by-zero-2.rs:5:14
|
7
tests/run-pass/panic/overflowing-lsh-neg.rs
Normal file
7
tests/run-pass/panic/overflowing-lsh-neg.rs
Normal file
@ -0,0 +1,7 @@
|
||||
// ignore-windows: Unwind panicking does not currently work on Windows
|
||||
#![allow(exceeding_bitshifts)]
|
||||
#![allow(const_err)]
|
||||
|
||||
fn main() {
|
||||
let _n = 2i64 << -1;
|
||||
}
|
1
tests/run-pass/panic/overflowing-lsh-neg.stderr
Normal file
1
tests/run-pass/panic/overflowing-lsh-neg.stderr
Normal file
@ -0,0 +1 @@
|
||||
thread 'main' panicked at 'attempt to shift left with overflow', $DIR/overflowing-lsh-neg.rs:6:14
|
6
tests/run-pass/panic/overflowing-rsh-1.rs
Normal file
6
tests/run-pass/panic/overflowing-rsh-1.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// ignore-windows: Unwind panicking does not currently work on Windows
|
||||
#![allow(exceeding_bitshifts, const_err)]
|
||||
|
||||
fn main() {
|
||||
let _n = 1i64 >> 64;
|
||||
}
|
1
tests/run-pass/panic/overflowing-rsh-1.stderr
Normal file
1
tests/run-pass/panic/overflowing-rsh-1.stderr
Normal file
@ -0,0 +1 @@
|
||||
thread 'main' panicked at 'attempt to shift right with overflow', $DIR/overflowing-rsh-1.rs:5:14
|
@ -1,6 +1,7 @@
|
||||
// ignore-windows: Unwind panicking does not currently work on Windows
|
||||
#![allow(exceeding_bitshifts, const_err)]
|
||||
|
||||
fn main() {
|
||||
// Make sure we catch overflows that would be hidden by first casting the RHS to u32
|
||||
let _n = 1i64 >> (u32::max_value() as i64 + 1); //~ ERROR attempt to shift right with overflow
|
||||
let _n = 1i64 >> (u32::max_value() as i64 + 1);
|
||||
}
|
1
tests/run-pass/panic/overflowing-rsh-2.stderr
Normal file
1
tests/run-pass/panic/overflowing-rsh-2.stderr
Normal file
@ -0,0 +1 @@
|
||||
thread 'main' panicked at 'attempt to shift right with overflow', $DIR/overflowing-rsh-2.rs:6:14
|
4
tests/run-pass/panic/panic1.rs
Normal file
4
tests/run-pass/panic/panic1.rs
Normal file
@ -0,0 +1,4 @@
|
||||
// ignore-windows: Unwind panicking does not currently work on Windows
|
||||
fn main() {
|
||||
std::panic!("panicking from libstd");
|
||||
}
|
1
tests/run-pass/panic/panic1.stderr
Normal file
1
tests/run-pass/panic/panic1.stderr
Normal file
@ -0,0 +1 @@
|
||||
thread 'main' panicked at 'panicking from libstd', $DIR/panic1.rs:3:5
|
4
tests/run-pass/panic/panic2.rs
Normal file
4
tests/run-pass/panic/panic2.rs
Normal file
@ -0,0 +1,4 @@
|
||||
// ignore-windows: Unwind panicking does not currently work on Windows
|
||||
fn main() {
|
||||
std::panic!("{}-panicking from libstd", 42);
|
||||
}
|
1
tests/run-pass/panic/panic2.stderr
Normal file
1
tests/run-pass/panic/panic2.stderr
Normal file
@ -0,0 +1 @@
|
||||
thread 'main' panicked at '42-panicking from libstd', $DIR/panic2.rs:3:5
|
4
tests/run-pass/panic/panic3.rs
Normal file
4
tests/run-pass/panic/panic3.rs
Normal file
@ -0,0 +1,4 @@
|
||||
// ignore-windows: Unwind panicking does not currently work on Windows
|
||||
fn main() {
|
||||
core::panic!("panicking from libcore");
|
||||
}
|
1
tests/run-pass/panic/panic3.stderr
Normal file
1
tests/run-pass/panic/panic3.stderr
Normal file
@ -0,0 +1 @@
|
||||
thread 'main' panicked at 'panicking from libcore', $DIR/panic3.rs:3:5
|
4
tests/run-pass/panic/panic4.rs
Normal file
4
tests/run-pass/panic/panic4.rs
Normal file
@ -0,0 +1,4 @@
|
||||
// ignore-windows: Unwind panicking does not currently work on Windows
|
||||
fn main() {
|
||||
core::panic!("{}-panicking from libcore", 42);
|
||||
}
|
1
tests/run-pass/panic/panic4.stderr
Normal file
1
tests/run-pass/panic/panic4.stderr
Normal file
@ -0,0 +1 @@
|
||||
thread 'main' panicked at '42-panicking from libcore', $DIR/panic4.rs:3:5
|
@ -7,5 +7,5 @@ fn main() {
|
||||
let bad = unsafe {
|
||||
std::mem::transmute::<u64, &[u8]>(42)
|
||||
};
|
||||
bad[0]; //~ ERROR index out of bounds: the len is 0 but the index is 0
|
||||
bad[0];
|
||||
}
|
1
tests/run-pass/panic/transmute_fat2.stderr
Normal file
1
tests/run-pass/panic/transmute_fat2.stderr
Normal file
@ -0,0 +1 @@
|
||||
thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', $DIR/transmute_fat2.rs:10:5
|
Loading…
x
Reference in New Issue
Block a user