-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Other: Added lib/path tests and updated a few dependencies
- Loading branch information
Showing
5 changed files
with
78 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,21 @@ | ||
{ | ||
"name": "@protobufjs/path", | ||
"description": "A minimal path module to resolve Unix, Windows and URL paths alike.", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"author": "Daniel Wirtz <dcode+protobufjs@dcode.io>", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/dcodeIO/protobuf.js.git" | ||
}, | ||
"license": "BSD-3-Clause", | ||
"main": "index.js", | ||
"types": "index.d.ts" | ||
"types": "index.d.ts", | ||
"devDependencies": { | ||
"istanbul": "^0.4.5", | ||
"tape": "^4.6.3" | ||
}, | ||
"scripts": { | ||
"test": "tape tests/*.js", | ||
"coverage": "istanbul cover node_modules/tape/bin/tape tests/*.js" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
var tape = require("tape"); | ||
|
||
var path = require(".."); | ||
|
||
tape.test("path", function(test) { | ||
|
||
test.ok(path.isAbsolute("X:\\some\\path\\file.js"), "should identify absolute windows paths"); | ||
test.ok(path.isAbsolute("/some/path/file.js"), "should identify absolute unix paths"); | ||
|
||
test.notOk(path.isAbsolute("some\\path\\file.js"), "should identify relative windows paths"); | ||
test.notOk(path.isAbsolute("some/path/file.js"), "should identify relative unix paths"); | ||
|
||
var paths = [ | ||
{ | ||
actual: "X:\\some\\..\\.\\path\\\\file.js", | ||
normal: "X:/path/file.js", | ||
resolve: { | ||
origin: "X:/path/origin.js", | ||
expected: "X:/path/file.js" | ||
} | ||
}, { | ||
actual: "some\\..\\.\\path\\\\file.js", | ||
normal: "path/file.js", | ||
resolve: { | ||
origin: "X:/path/origin.js", | ||
expected: "X:/path/path/file.js" | ||
} | ||
}, { | ||
actual: "/some/.././path//file.js", | ||
normal: "/path/file.js", | ||
resolve: { | ||
origin: "/path/origin.js", | ||
expected: "/path/file.js" | ||
} | ||
}, { | ||
actual: "some/.././path//file.js", | ||
normal: "path/file.js", | ||
resolve: { | ||
origin: "", | ||
expected: "path/file.js" | ||
} | ||
}, { | ||
actual: ".././path//file.js", | ||
normal: "../path/file.js" | ||
}, { | ||
actual: "/.././path//file.js", | ||
normal: "/path/file.js" | ||
} | ||
]; | ||
|
||
paths.forEach(function(p) { | ||
test.equal(path.normalize(p.actual), p.normal, "should normalize " + p.actual); | ||
if (p.resolve) { | ||
test.equal(path.resolve(p.resolve.origin, p.actual), p.resolve.expected, "should resolve " + p.actual); | ||
test.equal(path.resolve(p.resolve.origin, p.normal, true), p.resolve.expected, "should resolve " + p.normal + " (already normalized)"); | ||
} | ||
}); | ||
|
||
test.end(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
require("../lib/path/tests"); |