|
| 1 | +use expect_test::expect; |
| 2 | + |
1 | 3 | #[salsa::input]
|
2 | 4 | struct MyInput {
|
3 | 5 | field: u32,
|
@@ -53,74 +55,74 @@ fn test() {
|
53 | 55 |
|
54 | 56 | let structs_info = <dyn salsa::Database>::structs_info(&db);
|
55 | 57 |
|
56 |
| - assert_eq!( |
57 |
| - format!("{structs_info:#?}"), |
58 |
| - r#"[ |
59 |
| - IngredientInfo { |
60 |
| - debug_name: "MyInput", |
61 |
| - count: 3, |
62 |
| - size_of_metadata: 84, |
63 |
| - size_of_fields: 12, |
64 |
| - }, |
65 |
| - IngredientInfo { |
66 |
| - debug_name: "MyTracked", |
67 |
| - count: 4, |
68 |
| - size_of_metadata: 112, |
69 |
| - size_of_fields: 16, |
70 |
| - }, |
71 |
| - IngredientInfo { |
72 |
| - debug_name: "MyInterned", |
73 |
| - count: 3, |
74 |
| - size_of_metadata: 156, |
75 |
| - size_of_fields: 12, |
76 |
| - }, |
77 |
| -]"# |
78 |
| - ); |
| 58 | + let expected = expect![[r#" |
| 59 | + [ |
| 60 | + IngredientInfo { |
| 61 | + debug_name: "MyInput", |
| 62 | + count: 3, |
| 63 | + size_of_metadata: 84, |
| 64 | + size_of_fields: 12, |
| 65 | + }, |
| 66 | + IngredientInfo { |
| 67 | + debug_name: "MyTracked", |
| 68 | + count: 4, |
| 69 | + size_of_metadata: 112, |
| 70 | + size_of_fields: 16, |
| 71 | + }, |
| 72 | + IngredientInfo { |
| 73 | + debug_name: "MyInterned", |
| 74 | + count: 3, |
| 75 | + size_of_metadata: 156, |
| 76 | + size_of_fields: 12, |
| 77 | + }, |
| 78 | + ]"#]]; |
| 79 | + |
| 80 | + expected.assert_eq(&format!("{structs_info:#?}")); |
79 | 81 |
|
80 | 82 | let mut queries_info = <dyn salsa::Database>::queries_info(&db)
|
81 | 83 | .into_iter()
|
82 | 84 | .collect::<Vec<_>>();
|
83 | 85 | queries_info.sort();
|
84 | 86 |
|
85 |
| - assert_eq!( |
86 |
| - format!("{queries_info:#?}"), |
87 |
| - r#"[ |
88 |
| - ( |
89 |
| - ( |
90 |
| - "MyInput", |
91 |
| - "(memory_usage::MyTracked, memory_usage::MyTracked)", |
92 |
| - ), |
93 |
| - IngredientInfo { |
94 |
| - debug_name: "(memory_usage::MyTracked, memory_usage::MyTracked)", |
95 |
| - count: 1, |
96 |
| - size_of_metadata: 132, |
97 |
| - size_of_fields: 16, |
98 |
| - }, |
99 |
| - ), |
100 |
| - ( |
101 |
| - ( |
102 |
| - "MyInput", |
103 |
| - "memory_usage::MyInterned", |
104 |
| - ), |
105 |
| - IngredientInfo { |
106 |
| - debug_name: "memory_usage::MyInterned", |
107 |
| - count: 3, |
108 |
| - size_of_metadata: 192, |
109 |
| - size_of_fields: 24, |
110 |
| - }, |
111 |
| - ), |
112 |
| - ( |
113 |
| - ( |
114 |
| - "MyInput", |
115 |
| - "memory_usage::MyTracked", |
116 |
| - ), |
117 |
| - IngredientInfo { |
118 |
| - debug_name: "memory_usage::MyTracked", |
119 |
| - count: 2, |
120 |
| - size_of_metadata: 192, |
121 |
| - size_of_fields: 16, |
122 |
| - }, |
123 |
| - ), |
124 |
| -]"# |
125 |
| - ) |
| 87 | + let expected = expect![[r#" |
| 88 | + [ |
| 89 | + ( |
| 90 | + ( |
| 91 | + "MyInput", |
| 92 | + "(memory_usage::MyTracked, memory_usage::MyTracked)", |
| 93 | + ), |
| 94 | + IngredientInfo { |
| 95 | + debug_name: "(memory_usage::MyTracked, memory_usage::MyTracked)", |
| 96 | + count: 1, |
| 97 | + size_of_metadata: 132, |
| 98 | + size_of_fields: 16, |
| 99 | + }, |
| 100 | + ), |
| 101 | + ( |
| 102 | + ( |
| 103 | + "MyInput", |
| 104 | + "memory_usage::MyInterned", |
| 105 | + ), |
| 106 | + IngredientInfo { |
| 107 | + debug_name: "memory_usage::MyInterned", |
| 108 | + count: 3, |
| 109 | + size_of_metadata: 192, |
| 110 | + size_of_fields: 24, |
| 111 | + }, |
| 112 | + ), |
| 113 | + ( |
| 114 | + ( |
| 115 | + "MyInput", |
| 116 | + "memory_usage::MyTracked", |
| 117 | + ), |
| 118 | + IngredientInfo { |
| 119 | + debug_name: "memory_usage::MyTracked", |
| 120 | + count: 2, |
| 121 | + size_of_metadata: 192, |
| 122 | + size_of_fields: 16, |
| 123 | + }, |
| 124 | + ), |
| 125 | + ]"#]]; |
| 126 | + |
| 127 | + expected.assert_eq(&format!("{queries_info:#?}")); |
126 | 128 | }
|
0 commit comments