Skip to content

Commit 9ad7121

Browse files
committed
Fixed windows-specific uri tests, added wrongly ignored files
1 parent 3ae315e commit 9ad7121

File tree

6 files changed

+47
-11
lines changed

6 files changed

+47
-11
lines changed

.gitignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
node_modules
22
**/.vscode-test
3-
**/out
4-
**/dist
3+
packages/*/out
4+
packages/*/dist
55
**/*.vsix

packages/vscode-sourcemap-helper-test/src/uri.test.ts

+22-9
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,13 @@ suite("Uri sanity checks", () => {
1717
});
1818

1919
test("Uri.file() with Windows path with backslash", () => {
20-
// Observation: Normalizes drive letter and slashes
20+
// Observation: Normalizes drive letter and slashes on Windows, not other OS
2121
let uri = vscode.Uri.file("C:\\test\\file.txt")
22-
assert.equal("file:///c:/test/file.txt", uri.toString(true));
22+
if (process.platform === "win32") {
23+
assert.equal("file:///c:/test/file.txt", uri.toString(true));
24+
} else {
25+
assert.equal("file:///c:\\test\\file.txt", uri.toString(true));
26+
}
2327
});
2428

2529
test("Uri.file() with Windows path with frontslash", () => {
@@ -41,13 +45,16 @@ suite("Uri sanity checks", () => {
4145
});
4246

4347
test("Uri.parse() with incorrect two-slash Windows path", () => {
44-
// Observation: "C:" becomes the authority, fsPath resolves UNC-path to "C:" host
48+
// Observation: "C:" becomes the authority, fsPath resolves UNC-path to "C:" host on Windows
4549
let uri = vscode.Uri.parse("file://C:/test/dir/file.txt")
4650
assert.equal("C:", uri.authority);
4751
assert.equal("/test/dir/file.txt", uri.path, "path");
4852

49-
// TODO; Backslashes here are prob windows-only
50-
assert.equal("\\\\C:\\test\\dir\\file.txt", uri.fsPath, "fsPath");
53+
if (process.platform === "win32") {
54+
assert.equal("\\\\C:\\test\\dir\\file.txt", uri.fsPath, "fsPath");
55+
} else {
56+
assert.equal("//C:/test/dir/file.txt", uri.fsPath, "fsPath");
57+
}
5158

5259
assert.equal("file://c:/test/dir/file.txt", uri.toString(true));
5360
})
@@ -58,8 +65,11 @@ suite("Uri sanity checks", () => {
5865
assert.equal("", uri.authority, "authority");
5966
assert.equal("/C:/test/dir/file.txt", uri.path, "path");
6067

61-
// TODO; Backslashes here are prob windows-only
62-
assert.equal("c:\\test\\dir\\file.txt", uri.fsPath, "fsPath");
68+
if (process.platform === "win32") {
69+
assert.equal("c:\\test\\dir\\file.txt", uri.fsPath, "fsPath");
70+
} else {
71+
assert.equal("c:/test/dir/file.txt", uri.fsPath, "fsPath");
72+
}
6373

6474
assert.equal("file:///c:/test/dir/file.txt", uri.toString(true));
6575
})
@@ -70,8 +80,11 @@ suite("Uri sanity checks", () => {
7080
assert.equal("", uri.authority, "authority");
7181
assert.equal("/dir/file.txt", uri.path, "path");
7282

73-
// TODO; Backslashes here are prob windows-only
74-
assert.equal("\\dir\\file.txt", uri.fsPath, "fsPath");
83+
if (process.platform === "win32") {
84+
assert.equal("\\dir\\file.txt", uri.fsPath, "fsPath");
85+
} else {
86+
assert.equal("/dir/file.txt", uri.fsPath, "fsPath");
87+
}
7588

7689
assert.equal("file:///dir/file.txt", uri.toString(true));
7790
});

packages/vscode-sourcemap-helper-test/test-workspace/with_src_out/out/min.js

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/vscode-sourcemap-helper-test/test-workspace/with_src_out/out/min.js.map

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/vscode-sourcemap-helper-test/test-workspace/with_src_out_no_sourceRoot/out/min.js

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/vscode-sourcemap-helper-test/test-workspace/with_src_out_no_sourceRoot/out/min.js.map

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)