Last change
on this file since 571e0df was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
905 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | // Copyright 2014 Simon Lydell
|
---|
| 2 | // X11 (“MIT”) Licensed. (See LICENSE.)
|
---|
| 3 |
|
---|
| 4 | var path = require("path")
|
---|
| 5 | var assert = require("assert")
|
---|
| 6 | var urix = require("../")
|
---|
| 7 |
|
---|
| 8 | "use stict"
|
---|
| 9 |
|
---|
| 10 | function test(testPath, expected) {
|
---|
| 11 | path.sep = "\\"
|
---|
| 12 | assert.equal(urix(testPath), expected)
|
---|
| 13 | path.sep = "/"
|
---|
| 14 | assert.equal(urix(testPath), testPath)
|
---|
| 15 | }
|
---|
| 16 |
|
---|
| 17 | describe("urix", function() {
|
---|
| 18 |
|
---|
| 19 | it("is a function", function() {
|
---|
| 20 | assert.equal(typeof urix, "function")
|
---|
| 21 | })
|
---|
| 22 |
|
---|
| 23 |
|
---|
| 24 | it("converts backslashes to slashes", function() {
|
---|
| 25 | test("a\\b\\c", "a/b/c")
|
---|
| 26 | test("\\a\\b\\c", "/a/b/c")
|
---|
| 27 | test("a/b\\c", "a/b/c")
|
---|
| 28 | test("\\\\a\\\\\\b///c", "//a///b///c")
|
---|
| 29 | })
|
---|
| 30 |
|
---|
| 31 |
|
---|
| 32 | it("changes the drive letter to a slash", function() {
|
---|
| 33 | test("c:\\a", "/a")
|
---|
| 34 | test("C:\\a", "/a")
|
---|
| 35 | test("z:\\a", "/a")
|
---|
| 36 | test("c:a", "/a")
|
---|
| 37 | test("c:/a", "/a")
|
---|
| 38 | test("c:\\\\a", "//a")
|
---|
| 39 | test("c://a", "//a")
|
---|
| 40 | test("c:\\//a", "///a")
|
---|
| 41 | })
|
---|
| 42 |
|
---|
| 43 | })
|
---|
Note:
See
TracBrowser
for help on using the repository browser.