Debian Codegraph @

debian/rust-vendor/rstest/tests/resources/fixture/errors.rs

raw
1 use rstest::*;
2
3 #[fixture]
4 pub fn fixture() -> u32 {
5 42
6 }
7
8 #[fixture]
9 fn error_inner(fixture: u32) {
10 let a: u32 = "";
11 }
12
13 #[fixture]
14 fn error_cannot_resolve_fixture(no_fixture: u32) {}
15
16 #[fixture]
17 fn error_fixture_wrong_type(fixture: String) {}
18
19 #[fixture(not_a_fixture(24))]
20 fn error_inject_an_invalid_fixture(fixture: String) {}
21
22 #[fixture]
23 fn name() -> &'static str {
24 "name"
25 }
26
27 #[fixture]
28 fn f(name: &str) -> String {
29 name.to_owned()
30 }
31
32 #[fixture(f("first"), f("second"))]
33 fn error_inject_a_fixture_more_than_once(f: String) {}
34
35 struct T(u32);
36
37 #[fixture]
38 fn structed() -> T {
39 T(42)
40 }
41
42 #[fixture]
43 fn structed_injectd(fixture: u32) -> T {
44 T(fixture)
45 }
46
47 #[fixture]
48 fn error_destruct_without_resolve(T(a): T) {}
49
50 #[fixture]
51 fn error_destruct_without_resolve_also_with(#[with(21)] T(a): T) {}