Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Commit 3698e76

Browse files
committed
some tests to clarify what convertToNativePath does
1 parent 9f2c33a commit 3698e76

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

test/spec/FileUtils-test.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,23 @@ define(function (require, exports, module) {
5353
});
5454
});
5555

56+
describe("convertToNativePath", function () {
57+
it("should convert windows URL syntax to Windows native path.", function () {
58+
expect(FileUtils.convertToNativePath("/C:/foo/bar/baz.txt")).toBe("C:/foo/bar/baz.txt");
59+
});
60+
61+
it("should not modify a windows non-URL path syntax.", function () {
62+
expect(FileUtils.convertToNativePath("C:/foo/bar/baz.txt")).toBe("C:/foo/bar/baz.txt");
63+
});
64+
65+
it("should not modify a posix path.", function () {
66+
expect(FileUtils.convertToNativePath("/foo/bar/baz.txt")).toBe("/foo/bar/baz.txt");
67+
expect(FileUtils.convertToNativePath("foo/bar/baz.txt")).toBe("foo/bar/baz.txt");
68+
expect(FileUtils.convertToNativePath("/foo/bar/")).toBe("/foo/bar/");
69+
expect(FileUtils.convertToNativePath("foo/bar/")).toBe("foo/bar/");
70+
});
71+
});
72+
5673
describe("getDirectoryPath", function () {
5774

5875
it("should get the parent directory of a normalized win file path", function () {

0 commit comments

Comments
 (0)