diff options
Diffstat (limited to 'crates/hir_ty/src/tests.rs')
-rw-r--r-- | crates/hir_ty/src/tests.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/crates/hir_ty/src/tests.rs b/crates/hir_ty/src/tests.rs index 0445efc9e..510baadf2 100644 --- a/crates/hir_ty/src/tests.rs +++ b/crates/hir_ty/src/tests.rs | |||
@@ -157,13 +157,14 @@ fn infer_with_mismatches(content: &str, include_mismatches: bool) -> String { | |||
157 | (node.value.text_range(), node.value.text().to_string().replace("\n", " ")) | 157 | (node.value.text_range(), node.value.text().to_string().replace("\n", " ")) |
158 | }; | 158 | }; |
159 | let macro_prefix = if node.file_id != file_id.into() { "!" } else { "" }; | 159 | let macro_prefix = if node.file_id != file_id.into() { "!" } else { "" }; |
160 | let module = db.module_for_file(node.file_id.original_file(&db)); | ||
160 | format_to!( | 161 | format_to!( |
161 | buf, | 162 | buf, |
162 | "{}{:?} '{}': {}\n", | 163 | "{}{:?} '{}': {}\n", |
163 | macro_prefix, | 164 | macro_prefix, |
164 | range, | 165 | range, |
165 | ellipsize(text, 15), | 166 | ellipsize(text, 15), |
166 | ty.display(&db) | 167 | ty.display_test(&db, module).unwrap() |
167 | ); | 168 | ); |
168 | } | 169 | } |
169 | if include_mismatches { | 170 | if include_mismatches { |
@@ -174,13 +175,14 @@ fn infer_with_mismatches(content: &str, include_mismatches: bool) -> String { | |||
174 | for (src_ptr, mismatch) in &mismatches { | 175 | for (src_ptr, mismatch) in &mismatches { |
175 | let range = src_ptr.value.text_range(); | 176 | let range = src_ptr.value.text_range(); |
176 | let macro_prefix = if src_ptr.file_id != file_id.into() { "!" } else { "" }; | 177 | let macro_prefix = if src_ptr.file_id != file_id.into() { "!" } else { "" }; |
178 | let module = db.module_for_file(src_ptr.file_id.original_file(&db)); | ||
177 | format_to!( | 179 | format_to!( |
178 | buf, | 180 | buf, |
179 | "{}{:?}: expected {}, got {}\n", | 181 | "{}{:?}: expected {}, got {}\n", |
180 | macro_prefix, | 182 | macro_prefix, |
181 | range, | 183 | range, |
182 | mismatch.expected.display(&db), | 184 | mismatch.expected.display_test(&db, module).unwrap(), |
183 | mismatch.actual.display(&db), | 185 | mismatch.actual.display_test(&db, module).unwrap(), |
184 | ); | 186 | ); |
185 | } | 187 | } |
186 | } | 188 | } |