Skip to content

Commit cdd9034

Browse files
Rollup merge of rust-lang#54225 - pnkfelix:issue-53675-add-test-called-panic, r=petrochenkov
Regression test for rust-lang#53675. (Includes a couple variations on the theme. I confirmed that the ones in `in_expression_position` and `what_if_we_use_panic_directly_in_expr` both failed back on "rustc 1.30.0-nightly (0f063ae 2018-09-03)".) Fix rust-lang#53675
2 parents 108be3c + fc6e1ed commit cdd9034

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// rust-lang/rust#53675: At one point the compiler errored when a test
2+
// named `panic` used the `assert!` macro in expression position.
3+
4+
// compile-pass
5+
// compile-flags: --test
6+
7+
mod in_expression_position {
8+
#[test]
9+
fn panic() {
10+
assert!(true)
11+
}
12+
}
13+
14+
mod in_statement_position {
15+
#[test]
16+
fn panic() {
17+
assert!(true);
18+
}
19+
}
20+
21+
mod what_if_we_use_panic_directly_in_expr {
22+
#[test]
23+
#[should_panic]
24+
fn panic() {
25+
panic!("in expr")
26+
}
27+
}
28+
29+
30+
mod what_if_we_use_panic_directly_in_stmt {
31+
#[test]
32+
#[should_panic]
33+
fn panic() {
34+
panic!("in stmt");
35+
}
36+
}

0 commit comments

Comments
 (0)