]> git.lizzy.rs Git - rust.git/commitdiff
Use substr instead of endswith
authorEdwin Cheng <edwin0cheng@gmail.com>
Tue, 17 Dec 2019 13:43:19 +0000 (21:43 +0800)
committerEdwin Cheng <edwin0cheng@gmail.com>
Wed, 18 Dec 2019 02:50:54 +0000 (10:50 +0800)
editors/code/src/test/utils/diagnotics/rust.test.ts

index 9acd319b30e7b5297f5a39c0385c6f4ea137e0cf..358325cc8dde6082cb0eda52f1fbdbe38483bf34 100644 (file)
@@ -212,7 +212,7 @@ describe('mapRustDiagnosticToVsCode', () => {
         assert.strictEqual(
             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}`',
             ].join('\n'),
         );
@@ -229,8 +229,8 @@ describe('mapRustDiagnosticToVsCode', () => {
         // The file url should be normal file
         // Ignore the first part because it depends on vs workspace location
         assert.strictEqual(
-            true,
-            location.uri.toString().endsWith('src/main.rs'),
+            location.uri.path.substr(-'src/main.rs'.length),
+            'src/main.rs',
         );
     });
 });