Use substr instead of endswith

This commit is contained in:
Edwin Cheng 2019-12-17 21:43:19 +08:00
parent 63c59308e6
commit bb9c60d908

View File

@ -212,7 +212,7 @@ describe('mapRustDiagnosticToVsCode', () => {
assert.strictEqual( assert.strictEqual(
diagnostic.message, diagnostic.message,
[ [
'can\'t compare `{integer}` with `&str`', "can't compare `{integer}` with `&str`",
'the trait `std::cmp::PartialEq<&str>` is not implemented for `{integer}`', 'the trait `std::cmp::PartialEq<&str>` is not implemented for `{integer}`',
].join('\n'), ].join('\n'),
); );
@ -229,8 +229,8 @@ describe('mapRustDiagnosticToVsCode', () => {
// The file url should be normal file // The file url should be normal file
// Ignore the first part because it depends on vs workspace location // Ignore the first part because it depends on vs workspace location
assert.strictEqual( assert.strictEqual(
true, location.uri.path.substr(-'src/main.rs'.length),
location.uri.toString().endsWith('src/main.rs'), 'src/main.rs',
); );
}); });
}); });