Debian Codegraph @

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

raw
1 use rstest::*;
2
3 #[fixture]
4 fn fx_base_impl_return() -> impl Iterator<Item=u32> { std::iter::once(42) }
5
6 #[fixture]
7 fn fx_base_impl_input(mut fx_base_impl_return: impl Iterator<Item=u32>) -> u32 {
8 fx_base_impl_return.next().unwrap()
9 }
10
11 #[rstest]
12 fn base_impl_return(mut fx_base_impl_return: impl Iterator<Item=u32>) {
13 assert_eq!(42, fx_base_impl_return.next().unwrap());
14 }
15
16 #[rstest]
17 fn base_impl_input(mut fx_base_impl_input: u32) {
18 assert_eq!(42, fx_base_impl_input);
19 }
20
21 #[fixture]
22 fn fx_nested_impl_return() -> impl Iterator<Item=impl ToString> { std::iter::once(42) }
23
24 #[fixture]
25 fn fx_nested_impl_input(mut fx_nested_impl_return: impl Iterator<Item=impl ToString>) -> String {
26 fx_nested_impl_return.next().unwrap().to_string()
27 }
28
29 #[rstest]
30 fn nested_impl_return(mut fx_nested_impl_return: impl Iterator<Item=impl ToString>) {
31 assert_eq!("42", fx_nested_impl_return.next().unwrap().to_string());
32 }
33
34 #[rstest]
35 fn nested_impl_input(mut fx_nested_impl_input: String) {
36 assert_eq!("42", &fx_nested_impl_input);
37 }
38
39 #[fixture]
40 fn fx_nested_multiple_impl_return() -> (impl Iterator<Item=impl ToString>, impl ToString) {
41 (std::iter::once(42), 42i32)
42 }
43
44 #[fixture]
45 fn fx_nested_multiple_impl_input(mut fx_nested_multiple_impl_return: (impl Iterator<Item=impl ToString>, impl ToString)) -> bool {
46 fx_nested_multiple_impl_return.0.next().unwrap().to_string() == fx_nested_multiple_impl_return.1.to_string()
47 }
48
49 #[rstest]
50 fn nested_multiple_impl_return(mut fx_nested_multiple_impl_return: (impl Iterator<Item=impl ToString>, impl ToString)) {
51 assert_eq!(fx_nested_multiple_impl_return.0.next().unwrap().to_string(), fx_nested_multiple_impl_return.1.to_string());
52 }
53
54 #[rstest]
55 fn nested_multiple_impl_input(fx_nested_multiple_impl_input: bool) {
56 assert!(fx_nested_multiple_impl_input);
57 }