aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/test/utils/diagnotics
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-12-18 03:03:51 +0000
committerGitHub <[email protected]>2019-12-18 03:03:51 +0000
commit46ca40ccfced6945e05a25979a2703ad967d2fe0 (patch)
treeda8702614f55f0511f92c41b6bf50c506aaac3a9 /editors/code/src/test/utils/diagnotics
parentee93fac7767d36ee91d5a0029bb58023765c72d5 (diff)
parentbb9c60d90863b21a0e981f00e354d02b0e9fb584 (diff)
Merge #2575
2575: [VS Code Extension] Remap error location if it extracted inside macros r=edwin0cheng a=edwin0cheng It should fix for #2569 Co-authored-by: Edwin Cheng <[email protected]>
Diffstat (limited to 'editors/code/src/test/utils/diagnotics')
-rw-r--r--editors/code/src/test/utils/diagnotics/rust.test.ts34
1 files changed, 34 insertions, 0 deletions
diff --git a/editors/code/src/test/utils/diagnotics/rust.test.ts b/editors/code/src/test/utils/diagnotics/rust.test.ts
index 0222dbbaa..358325cc8 100644
--- a/editors/code/src/test/utils/diagnotics/rust.test.ts
+++ b/editors/code/src/test/utils/diagnotics/rust.test.ts
@@ -199,4 +199,38 @@ describe('mapRustDiagnosticToVsCode', () => {
199 // There are no suggested fixes 199 // There are no suggested fixes
200 assert.strictEqual(suggestedFixes.length, 0); 200 assert.strictEqual(suggestedFixes.length, 0);
201 }); 201 });
202
203 it('should map a macro invocation location to normal file path', () => {
204 const { location, diagnostic, suggestedFixes } = mapFixtureToVsCode(
205 'error/E0277',
206 );
207
208 assert.strictEqual(
209 diagnostic.severity,
210 vscode.DiagnosticSeverity.Error,
211 );
212 assert.strictEqual(
213 diagnostic.message,
214 [
215 "can't compare `{integer}` with `&str`",
216 'the trait `std::cmp::PartialEq<&str>` is not implemented for `{integer}`',
217 ].join('\n'),
218 );
219 assert.strictEqual(diagnostic.code, 'E0277');
220 assert.strictEqual(diagnostic.source, 'rustc');
221 assert.deepStrictEqual(diagnostic.tags, []);
222
223 // No related information
224 assert.deepStrictEqual(diagnostic.relatedInformation, []);
225
226 // There are no suggested fixes
227 assert.strictEqual(suggestedFixes.length, 0);
228
229 // The file url should be normal file
230 // Ignore the first part because it depends on vs workspace location
231 assert.strictEqual(
232 location.uri.path.substr(-'src/main.rs'.length),
233 'src/main.rs',
234 );
235 });
202}); 236});