1 var tape = require("tape");
\r
3 var path = require("..");
\r
5 tape.test("path", function(test) {
\r
7 test.ok(path.isAbsolute("X:\\some\\path\\file.js"), "should identify absolute windows paths");
\r
8 test.ok(path.isAbsolute("/some/path/file.js"), "should identify absolute unix paths");
\r
10 test.notOk(path.isAbsolute("some\\path\\file.js"), "should identify relative windows paths");
\r
11 test.notOk(path.isAbsolute("some/path/file.js"), "should identify relative unix paths");
\r
15 actual: "X:\\some\\..\\.\\path\\\\file.js",
\r
16 normal: "X:/path/file.js",
\r
18 origin: "X:/path/origin.js",
\r
19 expected: "X:/path/file.js"
\r
22 actual: "some\\..\\.\\path\\\\file.js",
\r
23 normal: "path/file.js",
\r
25 origin: "X:/path/origin.js",
\r
26 expected: "X:/path/path/file.js"
\r
29 actual: "/some/.././path//file.js",
\r
30 normal: "/path/file.js",
\r
32 origin: "/path/origin.js",
\r
33 expected: "/path/file.js"
\r
36 actual: "some/.././path//file.js",
\r
37 normal: "path/file.js",
\r
40 expected: "path/file.js"
\r
43 actual: ".././path//file.js",
\r
44 normal: "../path/file.js"
\r
46 actual: "/.././path//file.js",
\r
47 normal: "/path/file.js"
\r
51 paths.forEach(function(p) {
\r
52 test.equal(path.normalize(p.actual), p.normal, "should normalize " + p.actual);
\r
54 test.equal(path.resolve(p.resolve.origin, p.actual), p.resolve.expected, "should resolve " + p.actual);
\r
55 test.equal(path.resolve(p.resolve.origin, p.normal, true), p.resolve.expected, "should resolve " + p.normal + " (already normalized)");
\r