]> git.lizzy.rs Git - rust.git/blob - src/test/ui/test-panic-abort.rs
b0679ea1d3df2daf38c3174e8d599e6972a30d36
[rust.git] / src / test / ui / test-panic-abort.rs
1 // no-prefer-dynamic
2 // compile-flags: --test -Cpanic=abort -Zpanic_abort_tests
3 // run-flags: --test-threads=1
4 // run-fail
5 // check-run-results
6 // exec-env:RUST_BACKTRACE=0
7
8 // ignore-wasm no panic or subprocess support
9 // ignore-emscripten no panic or subprocess support
10
11 #![cfg(test)]
12
13 use std::io::Write;
14
15 #[test]
16 fn it_works() {
17     assert_eq!(1 + 1, 2);
18 }
19
20 #[test]
21 #[should_panic]
22 fn it_panics() {
23     assert_eq!(1 + 1, 4);
24 }
25
26 #[test]
27 fn it_fails() {
28     println!("hello, world");
29     writeln!(std::io::stdout(), "testing123").unwrap();
30     writeln!(std::io::stderr(), "testing321").unwrap();
31     assert_eq!(1 + 1, 5);
32 }
33
34 #[test]
35 fn it_exits() {
36     std::process::exit(123);
37 }