Skip to content
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
1 change: 1 addition & 0 deletions tests/ui/test-attrs/issue-109816.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@ compile-flags: --test
//@ reference: attributes.testing.test.allowed-positions

fn align_offset_weird_strides() {
#[test]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/test-attrs/issue-109816.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: the `#[test]` attribute may only be used on a free function
--> $DIR/issue-109816.rs:4:5
--> $DIR/issue-109816.rs:5:5
|
LL | #[test]
| ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions
Expand Down
1 change: 1 addition & 0 deletions tests/ui/test-attrs/test-attr-non-associated-functions.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@ compile-flags:--test
//@ reference: attributes.testing.test.allowed-positions

struct A {}

Expand Down
4 changes: 2 additions & 2 deletions tests/ui/test-attrs/test-attr-non-associated-functions.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: the `#[test]` attribute may only be used on a free function
--> $DIR/test-attr-non-associated-functions.rs:6:5
--> $DIR/test-attr-non-associated-functions.rs:7:5
|
LL | #[test]
| ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions
Expand All @@ -11,7 +11,7 @@ LL + #[cfg(test)]
|

error: the `#[test]` attribute may only be used on a free function
--> $DIR/test-attr-non-associated-functions.rs:11:5
--> $DIR/test-attr-non-associated-functions.rs:12:5
|
LL | #[test]
| ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions
Expand Down
1 change: 1 addition & 0 deletions tests/ui/test-attrs/test-function-signature.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@ compile-flags: --test
//@ reference: attributes.testing.test.allowed-positions

#[test]
fn foo() -> Result<(), ()> {
Expand Down
10 changes: 5 additions & 5 deletions tests/ui/test-attrs/test-function-signature.stderr
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
error: functions used as tests can not have any arguments
--> $DIR/test-function-signature.rs:14:1
--> $DIR/test-function-signature.rs:15:1
|
LL | fn baz(val: i32) {}
| ^^^^^^^^^^^^^^^^^^^

error: functions used as tests can not have any non-lifetime generic parameters
--> $DIR/test-function-signature.rs:22:1
--> $DIR/test-function-signature.rs:23:1
|
LL | fn type_generic<T>() {}
| ^^^^^^^^^^^^^^^^^^^^^^^

error: functions used as tests can not have any non-lifetime generic parameters
--> $DIR/test-function-signature.rs:25:1
--> $DIR/test-function-signature.rs:26:1
|
LL | fn const_generic<const N: usize>() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: functions used as tests can not have any arguments
--> $DIR/test-function-signature.rs:30:5
--> $DIR/test-function-signature.rs:31:5
|
LL | fn foo(arg: ()) {}
| ^^^^^^^^^^^^^^^^^^

error[E0277]: the trait bound `i32: Termination` is not satisfied
--> $DIR/test-function-signature.rs:9:13
--> $DIR/test-function-signature.rs:10:13
|
LL | #[test]
| ------- in this attribute macro expansion
Expand Down
1 change: 1 addition & 0 deletions tests/ui/test-attrs/test-on-not-fn.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@ compile-flags: --test
//@ reference: attributes.testing.test.allowed-positions

#[test] //~ ERROR: the `#[test]` attribute may only be used on a free function
mod test {}
Expand Down
24 changes: 12 additions & 12 deletions tests/ui/test-attrs/test-on-not-fn.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: the `#[test]` attribute may only be used on a free function
--> $DIR/test-on-not-fn.rs:3:1
--> $DIR/test-on-not-fn.rs:4:1
|
LL | #[test]
| ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions
Expand All @@ -13,7 +13,7 @@ LL + #[cfg(test)]
|

error: the `#[test]` attribute may only be used on a free function
--> $DIR/test-on-not-fn.rs:6:1
--> $DIR/test-on-not-fn.rs:7:1
|
LL | #[test]
| ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions
Expand All @@ -33,7 +33,7 @@ LL + #[cfg(test)]
|

error: the `#[test]` attribute may only be used on a free function
--> $DIR/test-on-not-fn.rs:20:1
--> $DIR/test-on-not-fn.rs:21:1
|
LL | #[test]
| ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions
Expand All @@ -47,7 +47,7 @@ LL + #[cfg(test)]
|

error: the `#[test]` attribute may only be used on a free function
--> $DIR/test-on-not-fn.rs:23:1
--> $DIR/test-on-not-fn.rs:24:1
|
LL | #[test]
| ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions
Expand All @@ -61,7 +61,7 @@ LL + #[cfg(test)]
|

error: the `#[test]` attribute may only be used on a free function
--> $DIR/test-on-not-fn.rs:26:1
--> $DIR/test-on-not-fn.rs:27:1
|
LL | #[test]
| ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions
Expand All @@ -75,7 +75,7 @@ LL + #[cfg(test)]
|

error: the `#[test]` attribute may only be used on a free function
--> $DIR/test-on-not-fn.rs:29:1
--> $DIR/test-on-not-fn.rs:30:1
|
LL | #[test]
| ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions
Expand All @@ -89,7 +89,7 @@ LL + #[cfg(test)]
|

error: the `#[test]` attribute may only be used on a free function
--> $DIR/test-on-not-fn.rs:32:1
--> $DIR/test-on-not-fn.rs:33:1
|
LL | #[test]
| ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions
Expand All @@ -103,7 +103,7 @@ LL + #[cfg(test)]
|

error: the `#[test]` attribute may only be used on a free function
--> $DIR/test-on-not-fn.rs:35:1
--> $DIR/test-on-not-fn.rs:36:1
|
LL | #[test]
| ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions
Expand All @@ -119,7 +119,7 @@ LL + #[cfg(test)]
|

error: the `#[test]` attribute may only be used on a free function
--> $DIR/test-on-not-fn.rs:40:1
--> $DIR/test-on-not-fn.rs:41:1
|
LL | #[test]
| ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions
Expand All @@ -133,7 +133,7 @@ LL + #[cfg(test)]
|

error: the `#[test]` attribute may only be used on a free function
--> $DIR/test-on-not-fn.rs:43:1
--> $DIR/test-on-not-fn.rs:44:1
|
LL | #[test]
| ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions
Expand All @@ -150,7 +150,7 @@ LL + #[cfg(test)]
|

error: the `#[test]` attribute may only be used on a free function
--> $DIR/test-on-not-fn.rs:50:1
--> $DIR/test-on-not-fn.rs:51:1
|
LL | #[test]
| ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions
Expand All @@ -168,7 +168,7 @@ LL + #[cfg(test)]
|

warning: the `#[test]` attribute may only be used on a free function
--> $DIR/test-on-not-fn.rs:61:1
--> $DIR/test-on-not-fn.rs:62:1
|
LL | #[test]
| ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions
Expand Down
1 change: 1 addition & 0 deletions tests/ui/test-attrs/test-passed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
//@ run-pass
//@ check-run-results
//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
//@ reference: attributes.testing.test.success

// Tests the output of the test harness with only passed tests.

Expand Down
1 change: 1 addition & 0 deletions tests/ui/test-attrs/test-should-panic-attr.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@ compile-flags: --test
//@ reference: attributes.testing.should_panic.syntax

#[test]
#[should_panic = "foo"]
Expand Down
8 changes: 4 additions & 4 deletions tests/ui/test-attrs/test-should-panic-attr.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0539]: malformed `should_panic` attribute input
--> $DIR/test-should-panic-attr.rs:10:1
--> $DIR/test-should-panic-attr.rs:11:1
|
LL | #[should_panic(expected)]
| ^^^^^^^^^^^^^^^--------^^
Expand All @@ -19,7 +19,7 @@ LL + #[should_panic]
|

error[E0539]: malformed `should_panic` attribute input
--> $DIR/test-should-panic-attr.rs:19:1
--> $DIR/test-should-panic-attr.rs:20:1
|
LL | #[should_panic(expect)]
| ^^^^^^^^^^^^^^--------^
Expand All @@ -39,7 +39,7 @@ LL + #[should_panic]
|

error[E0539]: malformed `should_panic` attribute input
--> $DIR/test-should-panic-attr.rs:28:1
--> $DIR/test-should-panic-attr.rs:29:1
|
LL | #[should_panic(expected(foo, bar))]
| ^^^^^^^^^^^^^^^------------------^^
Expand All @@ -60,7 +60,7 @@ LL + #[should_panic]
|

error[E0805]: malformed `should_panic` attribute input
--> $DIR/test-should-panic-attr.rs:37:1
--> $DIR/test-should-panic-attr.rs:38:1
|
LL | #[should_panic(expected = "foo", bar)]
| ^^^^^^^^^^^^^^-----------------------^
Expand Down
1 change: 1 addition & 0 deletions tests/ui/test-attrs/test-should-panic-failed-show-span.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
//@ normalize-stdout: "TypeId\(0x[0-9a-f]+\)" -> "TypeId($$HEX)"
//@ needs-threads
//@ needs-unwind (panic)
//@ reference: attributes.testing.should_panic.expected

#[test]
#[should_panic]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@

thread 'should_panic_with_any_message' ($TID) panicked at $DIR/test-should-panic-failed-show-span.rs:15:5:
thread 'should_panic_with_any_message' ($TID) panicked at $DIR/test-should-panic-failed-show-span.rs:16:5:
Panic!
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

thread 'should_panic_with_message' ($TID) panicked at $DIR/test-should-panic-failed-show-span.rs:21:5:
thread 'should_panic_with_message' ($TID) panicked at $DIR/test-should-panic-failed-show-span.rs:22:5:
message

thread 'should_panic_with_substring_panics_with_incorrect_string' ($TID) panicked at $DIR/test-should-panic-failed-show-span.rs:39:5:
thread 'should_panic_with_substring_panics_with_incorrect_string' ($TID) panicked at $DIR/test-should-panic-failed-show-span.rs:40:5:
ZOMGWTFBBQ

thread 'should_panic_with_substring_panics_with_non_string_value' ($TID) panicked at $DIR/test-should-panic-failed-show-span.rs:46:5:
thread 'should_panic_with_substring_panics_with_non_string_value' ($TID) panicked at $DIR/test-should-panic-failed-show-span.rs:47:5:
Box<dyn Any>
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ test should_panic_with_substring_panics_with_non_string_value - should panic ...
failures:

---- should_panic_with_any_message_does_not_panic stdout ----
note: test did not panic as expected at $DIR/test-should-panic-failed-show-span.rs:26:4
note: test did not panic as expected at $DIR/test-should-panic-failed-show-span.rs:27:4
---- should_panic_with_message_does_not_panic stdout ----
note: test did not panic as expected at $DIR/test-should-panic-failed-show-span.rs:32:4
note: test did not panic as expected at $DIR/test-should-panic-failed-show-span.rs:33:4
---- should_panic_with_substring_panics_with_incorrect_string stdout ----
note: panic did not contain expected string
panic message: "ZOMGWTFBBQ"
Expand Down
1 change: 1 addition & 0 deletions tests/ui/test-attrs/test-vs-cfg-test.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//@ run-pass
//@ compile-flags: --cfg test
//@ reference: cfg.test

// Make sure `--cfg test` does not inject test harness

Expand Down
Loading