.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / urix / test / index.js
1 // Copyright 2014 Simon Lydell\r
2 // X11 (“MIT”) Licensed. (See LICENSE.)\r
3 \r
4 var path   = require("path")\r
5 var assert = require("assert")\r
6 var urix   = require("../")\r
7 \r
8 "use stict"\r
9 \r
10 function test(testPath, expected) {\r
11   path.sep = "\\"\r
12   assert.equal(urix(testPath), expected)\r
13   path.sep = "/"\r
14   assert.equal(urix(testPath), testPath)\r
15 }\r
16 \r
17 describe("urix", function() {\r
18 \r
19   it("is a function", function() {\r
20     assert.equal(typeof urix, "function")\r
21   })\r
22 \r
23 \r
24   it("converts backslashes to slashes", function() {\r
25     test("a\\b\\c", "a/b/c")\r
26     test("\\a\\b\\c", "/a/b/c")\r
27     test("a/b\\c", "a/b/c")\r
28     test("\\\\a\\\\\\b///c", "//a///b///c")\r
29   })\r
30 \r
31 \r
32   it("changes the drive letter to a slash", function() {\r
33     test("c:\\a", "/a")\r
34     test("C:\\a", "/a")\r
35     test("z:\\a", "/a")\r
36     test("c:a", "/a")\r
37     test("c:/a", "/a")\r
38     test("c:\\\\a", "//a")\r
39     test("c://a", "//a")\r
40     test("c:\\//a", "///a")\r
41   })\r
42 \r
43 })\r