diff options
Diffstat (limited to 'src/test/ui/test-attrs')
48 files changed, 0 insertions, 1043 deletions
diff --git a/src/test/ui/test-attrs/auxiliary/test_macro.rs b/src/test/ui/test-attrs/auxiliary/test_macro.rs deleted file mode 100644 index 60a98ab6a..000000000 --- a/src/test/ui/test-attrs/auxiliary/test_macro.rs +++ /dev/null @@ -1,4 +0,0 @@ -#[macro_export] -macro_rules! test { - () => {}; -} diff --git a/src/test/ui/test-attrs/decl-macro-test.rs b/src/test/ui/test-attrs/decl-macro-test.rs deleted file mode 100644 index fcbe9f49e..000000000 --- a/src/test/ui/test-attrs/decl-macro-test.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Check that declarative macros can declare tests - -// check-pass -// compile-flags: --test - -#![feature(decl_macro)] - -macro create_test() { - #[test] - fn test() {} -} - -macro create_module_test() { - mod x { - #[test] - fn test() {} - } -} - -create_test!(); -create_test!(); -create_module_test!(); diff --git a/src/test/ui/test-attrs/inaccessible-test-modules.rs b/src/test/ui/test-attrs/inaccessible-test-modules.rs deleted file mode 100644 index f5b347937..000000000 --- a/src/test/ui/test-attrs/inaccessible-test-modules.rs +++ /dev/null @@ -1,9 +0,0 @@ -// compile-flags:--test - -// the `--test` harness creates modules with these textual names, but -// they should be inaccessible from normal code. -use main as x; //~ ERROR unresolved import `main` -use test as y; //~ ERROR unresolved import `test` - -#[test] -fn baz() {} diff --git a/src/test/ui/test-attrs/inaccessible-test-modules.stderr b/src/test/ui/test-attrs/inaccessible-test-modules.stderr deleted file mode 100644 index 0c16ecd4c..000000000 --- a/src/test/ui/test-attrs/inaccessible-test-modules.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0432]: unresolved import `main` - --> $DIR/inaccessible-test-modules.rs:5:5 - | -LL | use main as x; - | ----^^^^^ - | | - | no `main` in the root - | help: a similar name exists in the module: `main` - -error[E0432]: unresolved import `test` - --> $DIR/inaccessible-test-modules.rs:6:5 - | -LL | use test as y; - | ^^^^^^^^^ no `test` in the root - | -help: a similar name exists in the module - | -LL | use test as y; - | ~~~~ -help: consider importing this module instead - | -LL | use test::test; - | ~~~~~~~~~~~ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0432`. diff --git a/src/test/ui/test-attrs/issue-16597-empty.rs b/src/test/ui/test-attrs/issue-16597-empty.rs deleted file mode 100644 index 2bdd08575..000000000 --- a/src/test/ui/test-attrs/issue-16597-empty.rs +++ /dev/null @@ -1,5 +0,0 @@ -// run-pass -// compile-flags:--test - -// This verifies that the test generation doesn't crash when we have -// no tests - for more information, see PR #16892. diff --git a/src/test/ui/test-attrs/issue-16597.rs b/src/test/ui/test-attrs/issue-16597.rs deleted file mode 100644 index 35769bfc1..000000000 --- a/src/test/ui/test-attrs/issue-16597.rs +++ /dev/null @@ -1,10 +0,0 @@ -// run-pass -#![allow(unused_imports)] -// compile-flags:--test - -mod tests { - use super::*; - - #[test] - pub fn test(){} -} diff --git a/src/test/ui/test-attrs/issue-20823.rs b/src/test/ui/test-attrs/issue-20823.rs deleted file mode 100644 index 9e209d5d3..000000000 --- a/src/test/ui/test-attrs/issue-20823.rs +++ /dev/null @@ -1,5 +0,0 @@ -// run-pass -// compile-flags: --test - -#[test] -pub fn foo() {} diff --git a/src/test/ui/test-attrs/issue-36768.rs b/src/test/ui/test-attrs/issue-36768.rs deleted file mode 100644 index f671cbc82..000000000 --- a/src/test/ui/test-attrs/issue-36768.rs +++ /dev/null @@ -1,9 +0,0 @@ -// run-pass -// compile-flags:--test -#![deny(private_in_public)] - -#[test] fn foo() {} -mod foo {} - -#[test] fn core() {} -extern crate core; diff --git a/src/test/ui/test-attrs/issue-53675-a-test-called-panic.rs b/src/test/ui/test-attrs/issue-53675-a-test-called-panic.rs deleted file mode 100644 index e57303898..000000000 --- a/src/test/ui/test-attrs/issue-53675-a-test-called-panic.rs +++ /dev/null @@ -1,36 +0,0 @@ -// rust-lang/rust#53675: At one point the compiler errored when a test -// named `panic` used the `assert!` macro in expression position. - -// check-pass -// compile-flags: --test - -mod in_expression_position { - #[test] - fn panic() { - assert!(true) - } -} - -mod in_statement_position { - #[test] - fn panic() { - assert!(true); - } -} - -mod what_if_we_use_panic_directly_in_expr { - #[test] - #[should_panic] - fn panic() { - panic!("in expr") - } -} - - -mod what_if_we_use_panic_directly_in_stmt { - #[test] - #[should_panic] - fn panic() { - panic!("in stmt"); - } -} diff --git a/src/test/ui/test-attrs/run-unexported-tests.rs b/src/test/ui/test-attrs/run-unexported-tests.rs deleted file mode 100644 index f533a3ef8..000000000 --- a/src/test/ui/test-attrs/run-unexported-tests.rs +++ /dev/null @@ -1,12 +0,0 @@ -// run-fail -// compile-flags:--test -// check-stdout - -mod m { - pub fn exported() {} - - #[test] - fn unexported() { - panic!("ran an unexported test"); - } -} diff --git a/src/test/ui/test-attrs/test-attr-non-associated-functions.rs b/src/test/ui/test-attrs/test-attr-non-associated-functions.rs deleted file mode 100644 index 31e567c39..000000000 --- a/src/test/ui/test-attrs/test-attr-non-associated-functions.rs +++ /dev/null @@ -1,25 +0,0 @@ -// #[test] attribute is not allowed on associated functions or methods -// reworded error message -// compile-flags:--test - -struct A {} - -impl A { - #[test] - fn new() -> A { - //~^ ERROR `#[test]` attribute is only allowed on non associated functions - A {} - } - #[test] - fn recovery_witness() -> A { - //~^ ERROR `#[test]` attribute is only allowed on non associated functions - A {} - } -} - -#[test] -fn test() { - let _ = A::new(); -} - -fn main() {} diff --git a/src/test/ui/test-attrs/test-attr-non-associated-functions.stderr b/src/test/ui/test-attrs/test-attr-non-associated-functions.stderr deleted file mode 100644 index a81b8f398..000000000 --- a/src/test/ui/test-attrs/test-attr-non-associated-functions.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error: `#[test]` attribute is only allowed on non associated functions - --> $DIR/test-attr-non-associated-functions.rs:9:5 - | -LL | / fn new() -> A { -LL | | -LL | | A {} -LL | | } - | |_____^ - -error: `#[test]` attribute is only allowed on non associated functions - --> $DIR/test-attr-non-associated-functions.rs:14:5 - | -LL | / fn recovery_witness() -> A { -LL | | -LL | | A {} -LL | | } - | |_____^ - -error: aborting due to 2 previous errors - diff --git a/src/test/ui/test-attrs/test-cant-be-shadowed.rs b/src/test/ui/test-attrs/test-cant-be-shadowed.rs deleted file mode 100644 index 831372d45..000000000 --- a/src/test/ui/test-attrs/test-cant-be-shadowed.rs +++ /dev/null @@ -1,13 +0,0 @@ -// build-pass (FIXME(62277): could be check-pass?) -// aux-build:test_macro.rs -// compile-flags:--test - -#[macro_use] extern crate test_macro; - -#[test] -fn foo(){} - -macro_rules! test { () => () } - -#[test] -fn bar() {} diff --git a/src/test/ui/test-attrs/test-filter-multiple.rs b/src/test/ui/test-attrs/test-filter-multiple.rs deleted file mode 100644 index 04dd83b7f..000000000 --- a/src/test/ui/test-attrs/test-filter-multiple.rs +++ /dev/null @@ -1,17 +0,0 @@ -// run-pass -// compile-flags: --test -// run-flags: --test-threads=1 test1 test2 -// check-run-results -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" -// ignore-emscripten no threads support - -#[test] -fn test1() {} - -#[test] -fn test2() {} - -#[test] -fn test3() { - panic!("this should not run"); -} diff --git a/src/test/ui/test-attrs/test-filter-multiple.run.stdout b/src/test/ui/test-attrs/test-filter-multiple.run.stdout deleted file mode 100644 index 1aa684ed5..000000000 --- a/src/test/ui/test-attrs/test-filter-multiple.run.stdout +++ /dev/null @@ -1,7 +0,0 @@ - -running 2 tests -test test1 ... ok -test test2 ... ok - -test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 1 filtered out; finished in $TIME - diff --git a/src/test/ui/test-attrs/test-fn-signature-verification-for-explicit-return-type.rs b/src/test/ui/test-attrs/test-fn-signature-verification-for-explicit-return-type.rs deleted file mode 100644 index 585874e27..000000000 --- a/src/test/ui/test-attrs/test-fn-signature-verification-for-explicit-return-type.rs +++ /dev/null @@ -1,13 +0,0 @@ -// run-pass -// needs-unwind (#73509) - -#![feature(test)] - -// compile-flags: --test -extern crate test; - -#[bench] -pub fn bench_explicit_return_type(_: &mut ::test::Bencher) -> () {} - -#[test] -pub fn test_explicit_return_type() -> () {} diff --git a/src/test/ui/test-attrs/test-main-not-dead-attr.rs b/src/test/ui/test-attrs/test-main-not-dead-attr.rs deleted file mode 100644 index 0b2a9a354..000000000 --- a/src/test/ui/test-attrs/test-main-not-dead-attr.rs +++ /dev/null @@ -1,9 +0,0 @@ -// run-pass -// compile-flags: --test - -#![feature(rustc_attrs)] - -#![deny(dead_code)] - -#[rustc_main] -fn foo() { panic!(); } diff --git a/src/test/ui/test-attrs/test-main-not-dead.rs b/src/test/ui/test-attrs/test-main-not-dead.rs deleted file mode 100644 index 30a9c85e3..000000000 --- a/src/test/ui/test-attrs/test-main-not-dead.rs +++ /dev/null @@ -1,6 +0,0 @@ -// run-pass -// compile-flags: --test - -#![deny(dead_code)] - -fn main() { panic!(); } diff --git a/src/test/ui/test-attrs/test-on-not-fn.rs b/src/test/ui/test-attrs/test-on-not-fn.rs deleted file mode 100644 index a460480af..000000000 --- a/src/test/ui/test-attrs/test-on-not-fn.rs +++ /dev/null @@ -1,80 +0,0 @@ -// compile-flags: --test - -#[test] //~ ERROR: the `#[test]` attribute may only be used on a non-associated function -mod test {} - -#[test] //~ ERROR: the `#[test]` attribute may only be used on a non-associated function -mod loooooooooooooong_teeeeeeeeeest { - /* - this is a comment - this comment goes on for a very long time - this is to pad out the span for this module for a long time - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut - labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco - laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in - voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat - non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. - */ -} - -#[test] //~ ERROR: the `#[test]` attribute may only be used on a non-associated function -extern "C" {} - -#[test] //~ ERROR: the `#[test]` attribute may only be used on a non-associated function -trait Foo {} - -#[test] //~ ERROR: the `#[test]` attribute may only be used on a non-associated function -impl Foo for i32 {} - -#[test] //~ ERROR: the `#[test]` attribute may only be used on a non-associated function -const FOO: i32 = -1_i32; - -#[test] //~ ERROR: the `#[test]` attribute may only be used on a non-associated function -static BAR: u64 = 10_000_u64; - -#[test] //~ ERROR: the `#[test]` attribute may only be used on a non-associated function -enum MyUnit { - Unit, -} - -#[test] //~ ERROR: the `#[test]` attribute may only be used on a non-associated function -struct NewI32(i32); - -#[test] //~ ERROR: the `#[test]` attribute may only be used on a non-associated function -union Spooky { - x: i32, - y: u32, -} - -#[repr(C, align(64))] -#[test] //~ ERROR: the `#[test]` attribute may only be used on a non-associated function -#[derive(Copy, Clone, Debug)] -struct MoreAttrs { - a: i32, - b: u64, -} - -macro_rules! foo { - () => {}; -} - -#[test] //~ WARN: the `#[test]` attribute may only be used on a non-associated function -foo!(); - -// make sure it doesn't erroneously trigger on a real test -#[test] -fn real_test() { - assert_eq!(42_i32, 42_i32); -} - -// make sure it works with cfg test -#[cfg(test)] -mod real_tests { - #[cfg(test)] - fn foo() {} - - #[test] - fn bar() { - foo(); - } -} diff --git a/src/test/ui/test-attrs/test-on-not-fn.stderr b/src/test/ui/test-attrs/test-on-not-fn.stderr deleted file mode 100644 index fc2c5f62b..000000000 --- a/src/test/ui/test-attrs/test-on-not-fn.stderr +++ /dev/null @@ -1,173 +0,0 @@ -error: the `#[test]` attribute may only be used on a non-associated function - --> $DIR/test-on-not-fn.rs:3:1 - | -LL | #[test] - | ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions -LL | mod test {} - | ----------- expected a non-associated function, found a module - | -help: replace with conditional compilation to make the item only exist when tests are being run - | -LL | #[cfg(test)] - | ~~~~~~~~~~~~ - -error: the `#[test]` attribute may only be used on a non-associated function - --> $DIR/test-on-not-fn.rs:6:1 - | -LL | #[test] - | ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions -LL | / mod loooooooooooooong_teeeeeeeeeest { -LL | | /* -LL | | this is a comment -LL | | this comment goes on for a very long time -... | -LL | | */ -LL | | } - | |_- expected a non-associated function, found a module - | -help: replace with conditional compilation to make the item only exist when tests are being run - | -LL | #[cfg(test)] - | ~~~~~~~~~~~~ - -error: the `#[test]` attribute may only be used on a non-associated function - --> $DIR/test-on-not-fn.rs:20:1 - | -LL | #[test] - | ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions -LL | extern "C" {} - | ------------- expected a non-associated function, found an extern block - | -help: replace with conditional compilation to make the item only exist when tests are being run - | -LL | #[cfg(test)] - | ~~~~~~~~~~~~ - -error: the `#[test]` attribute may only be used on a non-associated function - --> $DIR/test-on-not-fn.rs:23:1 - | -LL | #[test] - | ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions -LL | trait Foo {} - | ------------ expected a non-associated function, found a trait - | -help: replace with conditional compilation to make the item only exist when tests are being run - | -LL | #[cfg(test)] - | ~~~~~~~~~~~~ - -error: the `#[test]` attribute may only be used on a non-associated function - --> $DIR/test-on-not-fn.rs:26:1 - | -LL | #[test] - | ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions -LL | impl Foo for i32 {} - | ------------------- expected a non-associated function, found an implementation - | -help: replace with conditional compilation to make the item only exist when tests are being run - | -LL | #[cfg(test)] - | ~~~~~~~~~~~~ - -error: the `#[test]` attribute may only be used on a non-associated function - --> $DIR/test-on-not-fn.rs:29:1 - | -LL | #[test] - | ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions -LL | const FOO: i32 = -1_i32; - | ------------------------ expected a non-associated function, found a constant item - | -help: replace with conditional compilation to make the item only exist when tests are being run - | -LL | #[cfg(test)] - | ~~~~~~~~~~~~ - -error: the `#[test]` attribute may only be used on a non-associated function - --> $DIR/test-on-not-fn.rs:32:1 - | -LL | #[test] - | ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions -LL | static BAR: u64 = 10_000_u64; - | ----------------------------- expected a non-associated function, found a static item - | -help: replace with conditional compilation to make the item only exist when tests are being run - | -LL | #[cfg(test)] - | ~~~~~~~~~~~~ - -error: the `#[test]` attribute may only be used on a non-associated function - --> $DIR/test-on-not-fn.rs:35:1 - | -LL | #[test] - | ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions -LL | / enum MyUnit { -LL | | Unit, -LL | | } - | |_- expected a non-associated function, found an enum - | -help: replace with conditional compilation to make the item only exist when tests are being run - | -LL | #[cfg(test)] - | ~~~~~~~~~~~~ - -error: the `#[test]` attribute may only be used on a non-associated function - --> $DIR/test-on-not-fn.rs:40:1 - | -LL | #[test] - | ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions -LL | struct NewI32(i32); - | ------------------- expected a non-associated function, found a struct - | -help: replace with conditional compilation to make the item only exist when tests are being run - | -LL | #[cfg(test)] - | ~~~~~~~~~~~~ - -error: the `#[test]` attribute may only be used on a non-associated function - --> $DIR/test-on-not-fn.rs:43:1 - | -LL | #[test] - | ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions -LL | / union Spooky { -LL | | x: i32, -LL | | y: u32, -LL | | } - | |_- expected a non-associated function, found a union - | -help: replace with conditional compilation to make the item only exist when tests are being run - | -LL | #[cfg(test)] - | ~~~~~~~~~~~~ - -error: the `#[test]` attribute may only be used on a non-associated function - --> $DIR/test-on-not-fn.rs:50:1 - | -LL | #[test] - | ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions -LL | #[derive(Copy, Clone, Debug)] -LL | / struct MoreAttrs { -LL | | a: i32, -LL | | b: u64, -LL | | } - | |_- expected a non-associated function, found a struct - | -help: replace with conditional compilation to make the item only exist when tests are being run - | -LL | #[cfg(test)] - | ~~~~~~~~~~~~ - -warning: the `#[test]` attribute may only be used on a non-associated function - --> $DIR/test-on-not-fn.rs:61:1 - | -LL | #[test] - | ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions -LL | foo!(); - | ------- expected a non-associated function, found an item macro invocation - | -help: replace with conditional compilation to make the item only exist when tests are being run - | -LL | #[cfg(test)] - | ~~~~~~~~~~~~ - -error: aborting due to 11 previous errors; 1 warning emitted - diff --git a/src/test/ui/test-attrs/test-panic-abort-disabled.rs b/src/test/ui/test-attrs/test-panic-abort-disabled.rs deleted file mode 100644 index 874dbdb42..000000000 --- a/src/test/ui/test-attrs/test-panic-abort-disabled.rs +++ /dev/null @@ -1,20 +0,0 @@ -// error-pattern:building tests with panic=abort is not supported -// no-prefer-dynamic -// compile-flags: --test -Cpanic=abort -Zpanic-abort-tests=no -// run-flags: --test-threads=1 - -// ignore-wasm no panic or subprocess support -// ignore-emscripten no panic or subprocess support - -#![cfg(test)] - -#[test] -fn it_works() { - assert_eq!(1 + 1, 2); -} - -#[test] -#[should_panic] -fn it_panics() { - assert_eq!(1 + 1, 4); -} diff --git a/src/test/ui/test-attrs/test-panic-abort-disabled.stderr b/src/test/ui/test-attrs/test-panic-abort-disabled.stderr deleted file mode 100644 index 9c65c7360..000000000 --- a/src/test/ui/test-attrs/test-panic-abort-disabled.stderr +++ /dev/null @@ -1,4 +0,0 @@ -error: building tests with panic=abort is not supported without `-Zpanic_abort_tests` - -error: aborting due to previous error - diff --git a/src/test/ui/test-attrs/test-panic-abort-nocapture.rs b/src/test/ui/test-attrs/test-panic-abort-nocapture.rs deleted file mode 100644 index af530cc1a..000000000 --- a/src/test/ui/test-attrs/test-panic-abort-nocapture.rs +++ /dev/null @@ -1,41 +0,0 @@ -// no-prefer-dynamic -// compile-flags: --test -Cpanic=abort -Zpanic_abort_tests -// run-flags: --test-threads=1 --nocapture -// run-fail -// check-run-results -// exec-env:RUST_BACKTRACE=0 -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" - -// ignore-wasm no panic or subprocess support -// ignore-emscripten no panic or subprocess support -// ignore-sgx no subprocess support - -#![cfg(test)] - -use std::io::Write; - -#[test] -fn it_works() { - println!("about to succeed"); - assert_eq!(1 + 1, 2); -} - -#[test] -#[should_panic] -fn it_panics() { - println!("about to panic"); - assert_eq!(1 + 1, 4); -} - -#[test] -fn it_fails() { - println!("about to fail"); - assert_eq!(1 + 1, 4); -} - -#[test] -fn it_writes_to_stdio() { - println!("hello, world"); - writeln!(std::io::stdout(), "testing123").unwrap(); - writeln!(std::io::stderr(), "testing321").unwrap(); -} diff --git a/src/test/ui/test-attrs/test-panic-abort-nocapture.run.stderr b/src/test/ui/test-attrs/test-panic-abort-nocapture.run.stderr deleted file mode 100644 index 727e9691c..000000000 --- a/src/test/ui/test-attrs/test-panic-abort-nocapture.run.stderr +++ /dev/null @@ -1,9 +0,0 @@ -thread 'main' panicked at 'assertion failed: `(left == right)` - left: `2`, - right: `4`', $DIR/test-panic-abort-nocapture.rs:33:5 -note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace -thread 'main' panicked at 'assertion failed: `(left == right)` - left: `2`, - right: `4`', $DIR/test-panic-abort-nocapture.rs:27:5 -note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace -testing321 diff --git a/src/test/ui/test-attrs/test-panic-abort-nocapture.run.stdout b/src/test/ui/test-attrs/test-panic-abort-nocapture.run.stdout deleted file mode 100644 index 8a91732a7..000000000 --- a/src/test/ui/test-attrs/test-panic-abort-nocapture.run.stdout +++ /dev/null @@ -1,23 +0,0 @@ - -running 4 tests -test it_fails ... about to fail -FAILED -test it_panics - should panic ... about to panic -ok -test it_works ... about to succeed -ok -test it_writes_to_stdio ... hello, world -testing123 -ok - -failures: - ----- it_fails stdout ---- ----- it_fails stderr ---- - - -failures: - it_fails - -test result: FAILED. 3 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME - diff --git a/src/test/ui/test-attrs/test-panic-abort.rs b/src/test/ui/test-attrs/test-panic-abort.rs deleted file mode 100644 index 931b7993c..000000000 --- a/src/test/ui/test-attrs/test-panic-abort.rs +++ /dev/null @@ -1,50 +0,0 @@ -// no-prefer-dynamic -// compile-flags: --test -Cpanic=abort -Zpanic_abort_tests -// run-flags: --test-threads=1 -// run-fail -// check-run-results -// exec-env:RUST_BACKTRACE=0 -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" - -// ignore-wasm no panic or subprocess support -// ignore-emscripten no panic or subprocess support -// ignore-sgx no subprocess support - -#![cfg(test)] - -use std::io::Write; -use std::env; - -#[test] -fn it_works() { - assert_eq!(1 + 1, 2); -} - -#[test] -#[should_panic] -fn it_panics() { - assert_eq!(1 + 1, 4); -} - -#[test] -fn it_fails() { - println!("hello, world"); - writeln!(std::io::stdout(), "testing123").unwrap(); - writeln!(std::io::stderr(), "testing321").unwrap(); - assert_eq!(1 + 1, 5); -} - -#[test] -fn it_exits() { - std::process::exit(123); -} - -#[test] -fn no_residual_environment() { - for (key, _) in env::vars() { - // Look for keys like __RUST_TEST_INVOKE. - if key.contains("TEST_INVOKE") { - panic!("shouldn't have '{}' in environment", key); - } - } -} diff --git a/src/test/ui/test-attrs/test-panic-abort.run.stdout b/src/test/ui/test-attrs/test-panic-abort.run.stdout deleted file mode 100644 index f608a8cdc..000000000 --- a/src/test/ui/test-attrs/test-panic-abort.run.stdout +++ /dev/null @@ -1,30 +0,0 @@ - -running 5 tests -test it_exits ... FAILED -test it_fails ... FAILED -test it_panics - should panic ... ok -test it_works ... ok -test no_residual_environment ... ok - -failures: - ----- it_exits stdout ---- ----- it_exits stderr ---- -note: got unexpected return code 123 ----- it_fails stdout ---- -hello, world -testing123 ----- it_fails stderr ---- -testing321 -thread 'main' panicked at 'assertion failed: `(left == right)` - left: `2`, - right: `5`', $DIR/test-panic-abort.rs:34:5 -note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace - - -failures: - it_exits - it_fails - -test result: FAILED. 3 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME - diff --git a/src/test/ui/test-attrs/test-panic-while-printing.rs b/src/test/ui/test-attrs/test-panic-while-printing.rs deleted file mode 100644 index 033c8beb4..000000000 --- a/src/test/ui/test-attrs/test-panic-while-printing.rs +++ /dev/null @@ -1,24 +0,0 @@ -// compile-flags:--test -// run-pass -// needs-unwind - -use std::fmt; -use std::fmt::{Display, Formatter}; - -pub struct A(Vec<u32>); - -impl Display for A { - fn fmt(&self, _f: &mut Formatter<'_>) -> fmt::Result { - self.0[0]; - Ok(()) - } -} - -#[test] -fn main() { - let result = std::panic::catch_unwind(|| { - let a = A(vec![]); - eprintln!("{}", a); - }); - assert!(result.is_err()); -} diff --git a/src/test/ui/test-attrs/test-passed-wasm.rs b/src/test/ui/test-attrs/test-passed-wasm.rs deleted file mode 100644 index 578aa4b17..000000000 --- a/src/test/ui/test-attrs/test-passed-wasm.rs +++ /dev/null @@ -1,20 +0,0 @@ -// no-prefer-dynamic -// compile-flags: --test -// run-flags: --test-threads=1 -// run-pass -// check-run-results -// only-wasm32 - -// Tests the output of the test harness with only passed tests. - -#![cfg(test)] - -#[test] -fn it_works() { - assert_eq!(1 + 1, 2); -} - -#[test] -fn it_works_too() { - assert_eq!(1 * 0, 0); -} diff --git a/src/test/ui/test-attrs/test-passed-wasm.run.stdout b/src/test/ui/test-attrs/test-passed-wasm.run.stdout deleted file mode 100644 index c3005a779..000000000 --- a/src/test/ui/test-attrs/test-passed-wasm.run.stdout +++ /dev/null @@ -1,7 +0,0 @@ - -running 2 tests -test it_works ... ok -test it_works_too ... ok - -test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out - diff --git a/src/test/ui/test-attrs/test-passed.rs b/src/test/ui/test-attrs/test-passed.rs deleted file mode 100644 index f65f00030..000000000 --- a/src/test/ui/test-attrs/test-passed.rs +++ /dev/null @@ -1,21 +0,0 @@ -// no-prefer-dynamic -// compile-flags: --test -// run-flags: --test-threads=1 -// run-pass -// check-run-results -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" -// ignore-wasm32 no support for `Instant` - -// Tests the output of the test harness with only passed tests. - -#![cfg(test)] - -#[test] -fn it_works() { - assert_eq!(1 + 1, 2); -} - -#[test] -fn it_works_too() { - assert_eq!(1 * 0, 0); -} diff --git a/src/test/ui/test-attrs/test-passed.run.stdout b/src/test/ui/test-attrs/test-passed.run.stdout deleted file mode 100644 index 17f70d607..000000000 --- a/src/test/ui/test-attrs/test-passed.run.stdout +++ /dev/null @@ -1,7 +0,0 @@ - -running 2 tests -test it_works ... ok -test it_works_too ... ok - -test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME - diff --git a/src/test/ui/test-attrs/test-runner-hides-buried-main.rs b/src/test/ui/test-attrs/test-runner-hides-buried-main.rs deleted file mode 100644 index 346aa868e..000000000 --- a/src/test/ui/test-attrs/test-runner-hides-buried-main.rs +++ /dev/null @@ -1,15 +0,0 @@ -// run-pass -// compile-flags: --test - -#![feature(rustc_attrs)] - -#![allow(dead_code)] - -mod a { - fn b() { - (|| { - #[rustc_main] - fn c() { panic!(); } - })(); - } -} diff --git a/src/test/ui/test-attrs/test-runner-hides-main.rs b/src/test/ui/test-attrs/test-runner-hides-main.rs deleted file mode 100644 index 0de1d64f0..000000000 --- a/src/test/ui/test-attrs/test-runner-hides-main.rs +++ /dev/null @@ -1,5 +0,0 @@ -// run-pass -// compile-flags:--test -// Building as a test runner means that a synthetic main will be run, -// not ours -pub fn main() { panic!(); } diff --git a/src/test/ui/test-attrs/test-runner-hides-start.rs b/src/test/ui/test-attrs/test-runner-hides-start.rs deleted file mode 100644 index 56212bb6f..000000000 --- a/src/test/ui/test-attrs/test-runner-hides-start.rs +++ /dev/null @@ -1,7 +0,0 @@ -// run-pass -// compile-flags: --test - -#![feature(start)] - -#[start] -fn start(_: isize, _: *const *const u8) -> isize { panic!(); } diff --git a/src/test/ui/test-attrs/test-should-fail-good-message.rs b/src/test/ui/test-attrs/test-should-fail-good-message.rs deleted file mode 100644 index 83519c452..000000000 --- a/src/test/ui/test-attrs/test-should-fail-good-message.rs +++ /dev/null @@ -1,14 +0,0 @@ -// run-pass -// needs-unwind -// compile-flags: --test -#[test] -#[should_panic(expected = "foo")] -pub fn test_foo() { - panic!("foo bar") -} - -#[test] -#[should_panic(expected = "foo")] -pub fn test_foo_dynamic() { - panic!("{} bar", "foo") -} diff --git a/src/test/ui/test-attrs/test-should-panic-attr.rs b/src/test/ui/test-attrs/test-should-panic-attr.rs deleted file mode 100644 index b71878406..000000000 --- a/src/test/ui/test-attrs/test-should-panic-attr.rs +++ /dev/null @@ -1,36 +0,0 @@ -// check-pass -// compile-flags: --test - -#[test] -#[should_panic = "foo"] -fn test1() { - panic!(); -} - -#[test] -#[should_panic(expected)] -//~^ WARN: argument must be of the form: -fn test2() { - panic!(); -} - -#[test] -#[should_panic(expect)] -//~^ WARN: argument must be of the form: -fn test3() { - panic!(); -} - -#[test] -#[should_panic(expected(foo, bar))] -//~^ WARN: argument must be of the form: -fn test4() { - panic!(); -} - -#[test] -#[should_panic(expected = "foo", bar)] -//~^ WARN: argument must be of the form: -fn test5() { - panic!(); -} diff --git a/src/test/ui/test-attrs/test-should-panic-attr.stderr b/src/test/ui/test-attrs/test-should-panic-attr.stderr deleted file mode 100644 index 492d1d5e0..000000000 --- a/src/test/ui/test-attrs/test-should-panic-attr.stderr +++ /dev/null @@ -1,34 +0,0 @@ -warning: argument must be of the form: `expected = "error message"` - --> $DIR/test-should-panic-attr.rs:11:1 - | -LL | #[should_panic(expected)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: errors in this attribute were erroneously allowed and will become a hard error in a future release - -warning: argument must be of the form: `expected = "error message"` - --> $DIR/test-should-panic-attr.rs:18:1 - | -LL | #[should_panic(expect)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: errors in this attribute were erroneously allowed and will become a hard error in a future release - -warning: argument must be of the form: `expected = "error message"` - --> $DIR/test-should-panic-attr.rs:25:1 - | -LL | #[should_panic(expected(foo, bar))] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: errors in this attribute were erroneously allowed and will become a hard error in a future release - -warning: argument must be of the form: `expected = "error message"` - --> $DIR/test-should-panic-attr.rs:32:1 - | -LL | #[should_panic(expected = "foo", bar)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: errors in this attribute were erroneously allowed and will become a hard error in a future release - -warning: 4 warnings emitted - diff --git a/src/test/ui/test-attrs/test-thread-capture.rs b/src/test/ui/test-attrs/test-thread-capture.rs deleted file mode 100644 index 53acca341..000000000 --- a/src/test/ui/test-attrs/test-thread-capture.rs +++ /dev/null @@ -1,33 +0,0 @@ -// compile-flags: --test -// run-fail -// run-flags: --test-threads=1 -// check-run-results -// exec-env:RUST_BACKTRACE=0 -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" -// ignore-emscripten no threads support -// needs-unwind - -#[test] -fn thready_pass() { - println!("fee"); - std::thread::spawn(|| { - println!("fie"); - println!("foe"); - }) - .join() - .unwrap(); - println!("fum"); -} - -#[test] -fn thready_fail() { - println!("fee"); - std::thread::spawn(|| { - println!("fie"); - println!("foe"); - }) - .join() - .unwrap(); - println!("fum"); - panic!(); -} diff --git a/src/test/ui/test-attrs/test-thread-capture.run.stdout b/src/test/ui/test-attrs/test-thread-capture.run.stdout deleted file mode 100644 index 513c8cf2a..000000000 --- a/src/test/ui/test-attrs/test-thread-capture.run.stdout +++ /dev/null @@ -1,21 +0,0 @@ - -running 2 tests -test thready_fail ... FAILED -test thready_pass ... ok - -failures: - ----- thready_fail stdout ---- -fee -fie -foe -fum -thread 'thready_fail' panicked at 'explicit panic', $DIR/test-thread-capture.rs:32:5 -note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace - - -failures: - thready_fail - -test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME - diff --git a/src/test/ui/test-attrs/test-thread-nocapture.rs b/src/test/ui/test-attrs/test-thread-nocapture.rs deleted file mode 100644 index 2b57eb8aa..000000000 --- a/src/test/ui/test-attrs/test-thread-nocapture.rs +++ /dev/null @@ -1,33 +0,0 @@ -// compile-flags: --test -// run-fail -// run-flags: --test-threads=1 --nocapture -// check-run-results -// exec-env:RUST_BACKTRACE=0 -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" -// ignore-emscripten no threads support -// needs-unwind - -#[test] -fn thready_pass() { - println!("fee"); - std::thread::spawn(|| { - println!("fie"); - println!("foe"); - }) - .join() - .unwrap(); - println!("fum"); -} - -#[test] -fn thready_fail() { - println!("fee"); - std::thread::spawn(|| { - println!("fie"); - println!("foe"); - }) - .join() - .unwrap(); - println!("fum"); - panic!(); -} diff --git a/src/test/ui/test-attrs/test-thread-nocapture.run.stderr b/src/test/ui/test-attrs/test-thread-nocapture.run.stderr deleted file mode 100644 index 8c905d1af..000000000 --- a/src/test/ui/test-attrs/test-thread-nocapture.run.stderr +++ /dev/null @@ -1,2 +0,0 @@ -thread 'thready_fail' panicked at 'explicit panic', $DIR/test-thread-nocapture.rs:32:5 -note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/src/test/ui/test-attrs/test-thread-nocapture.run.stdout b/src/test/ui/test-attrs/test-thread-nocapture.run.stdout deleted file mode 100644 index 9d2da5082..000000000 --- a/src/test/ui/test-attrs/test-thread-nocapture.run.stdout +++ /dev/null @@ -1,20 +0,0 @@ - -running 2 tests -test thready_fail ... fee -fie -foe -fum -FAILED -test thready_pass ... fee -fie -foe -fum -ok - -failures: - -failures: - thready_fail - -test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME - diff --git a/src/test/ui/test-attrs/test-type.rs b/src/test/ui/test-attrs/test-type.rs deleted file mode 100644 index f99e476ea..000000000 --- a/src/test/ui/test-attrs/test-type.rs +++ /dev/null @@ -1,27 +0,0 @@ -// compile-flags: --test -// run-flags: --test-threads=1 -// check-run-results -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" -// ignore-emscripten no threads support -// run-pass - -#[test] -fn test_ok() { - let _a = true; -} - -#[test] -#[should_panic] -fn test_panic() { - panic!(); -} - -#[test] -#[ignore = "msg"] -fn test_no_run() { - loop { - println!("Hello, world"); - } -} - -fn main() {} diff --git a/src/test/ui/test-attrs/test-type.run.stdout b/src/test/ui/test-attrs/test-type.run.stdout deleted file mode 100644 index 143c13a36..000000000 --- a/src/test/ui/test-attrs/test-type.run.stdout +++ /dev/null @@ -1,8 +0,0 @@ - -running 3 tests -test test_no_run ... ignored, msg -test test_ok ... ok -test test_panic - should panic ... ok - -test result: ok. 2 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in $TIME - diff --git a/src/test/ui/test-attrs/test-vs-cfg-test.rs b/src/test/ui/test-attrs/test-vs-cfg-test.rs deleted file mode 100644 index cd1cd33c2..000000000 --- a/src/test/ui/test-attrs/test-vs-cfg-test.rs +++ /dev/null @@ -1,9 +0,0 @@ -// run-pass -// compile-flags: --cfg test - -// Make sure `--cfg test` does not inject test harness - -#[test] -fn test() { panic!(); } - -fn main() {} diff --git a/src/test/ui/test-attrs/test-warns-dead-code.rs b/src/test/ui/test-attrs/test-warns-dead-code.rs deleted file mode 100644 index 4190885b6..000000000 --- a/src/test/ui/test-attrs/test-warns-dead-code.rs +++ /dev/null @@ -1,7 +0,0 @@ -// compile-flags: --test - -#![deny(dead_code)] - -fn dead() {} //~ error: function `dead` is never used - -fn main() {} diff --git a/src/test/ui/test-attrs/test-warns-dead-code.stderr b/src/test/ui/test-attrs/test-warns-dead-code.stderr deleted file mode 100644 index 6c0f28841..000000000 --- a/src/test/ui/test-attrs/test-warns-dead-code.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: function `dead` is never used - --> $DIR/test-warns-dead-code.rs:5:4 - | -LL | fn dead() {} - | ^^^^ - | -note: the lint level is defined here - --> $DIR/test-warns-dead-code.rs:3:9 - | -LL | #![deny(dead_code)] - | ^^^^^^^^^ - -error: aborting due to previous error - |