about summary refs log tree commit diff
path: root/tests/ui/test-attrs/test-should-panic-attr.rs
blob: e6de07d0094118cb9354e5993e34b15727e8b551 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//@ compile-flags: --test

#[test]
#[should_panic = "foo"]
fn test1() {
    panic!();
}

#[test]
#[should_panic(expected)]
//~^ ERROR malformed `should_panic` attribute input
//~| NOTE expected this to be of the form `expected = "..."`
//~| NOTE for more information, visit
fn test2() {
    panic!();
}

#[test]
#[should_panic(expect)]
//~^ ERROR malformed `should_panic` attribute input
//~| NOTE the only valid argument here is "expected"
//~| NOTE for more information, visit
fn test3() {
    panic!();
}

#[test]
#[should_panic(expected(foo, bar))]
//~^ ERROR malformed `should_panic` attribute input
//~| NOTE expected this to be of the form `expected = "..."`
//~| NOTE for more information, visit
fn test4() {
    panic!();
}

#[test]
#[should_panic(expected = "foo", bar)]
//~^ ERROR malformed `should_panic` attribute input
//~| NOTE expected a single argument here
//~| NOTE for more information, visit
fn test5() {
    panic!();
}