aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/test/utils
diff options
context:
space:
mode:
authorEdwin Cheng <[email protected]>2019-12-17 05:50:08 +0000
committerEdwin Cheng <[email protected]>2019-12-18 02:47:45 +0000
commit63c59308e6ece788084374c4fc393576684992a7 (patch)
treea87e4922a282ac9fbf74493fb27dc57aad7485ac /editors/code/src/test/utils
parentd2c1f8ee2606e10e196485d6bdbd87146d2545de (diff)
Add tests
Diffstat (limited to 'editors/code/src/test/utils')
-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..9acd319b3 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 true,
233 location.uri.toString().endsWith('src/main.rs'),
234 );
235 });
202}); 236});