]>
Commit | Line | Data |
---|---|---|
e74abb32 XL |
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 | |
fc512014 | 7 | // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" |
e74abb32 XL |
8 | |
9 | // ignore-wasm no panic or subprocess support | |
10 | // ignore-emscripten no panic or subprocess support | |
f9f354fc | 11 | // ignore-sgx no subprocess support |
e74abb32 XL |
12 | |
13 | #![cfg(test)] | |
14 | ||
15 | use std::io::Write; | |
dfeec247 | 16 | use std::env; |
e74abb32 XL |
17 | |
18 | #[test] | |
19 | fn it_works() { | |
20 | assert_eq!(1 + 1, 2); | |
21 | } | |
22 | ||
23 | #[test] | |
24 | #[should_panic] | |
25 | fn it_panics() { | |
26 | assert_eq!(1 + 1, 4); | |
27 | } | |
28 | ||
29 | #[test] | |
30 | fn it_fails() { | |
31 | println!("hello, world"); | |
32 | writeln!(std::io::stdout(), "testing123").unwrap(); | |
33 | writeln!(std::io::stderr(), "testing321").unwrap(); | |
34 | assert_eq!(1 + 1, 5); | |
35 | } | |
36 | ||
37 | #[test] | |
38 | fn it_exits() { | |
39 | std::process::exit(123); | |
40 | } | |
dfeec247 XL |
41 | |
42 | #[test] | |
43 | fn no_residual_environment() { | |
44 | for (key, _) in env::vars() { | |
45 | // Look for keys like __RUST_TEST_INVOKE. | |
46 | if key.contains("TEST_INVOKE") { | |
47 | panic!("shouldn't have '{}' in environment", key); | |
48 | } | |
49 | } | |
50 | } |