]> git.lizzy.rs Git - rust.git/blob - src/test/ui/test-attrs/issue-53675-a-test-called-panic.rs
:arrow_up: rust-analyzer
[rust.git] / src / test / ui / test-attrs / issue-53675-a-test-called-panic.rs
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 // check-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 }