summaryrefslogtreecommitdiff
path: root/lib/path.js
diff options
context:
space:
mode:
authorNathan Woltman <nwoltman@outlook.com>2015-07-31 17:47:49 -0400
committerRoman Reiss <me@silverwind.io>2015-08-09 12:29:01 +0200
commit2db57bdecc9a0c3cedbd3883d9ee3e8a20232608 (patch)
tree6ddcf70e24566ffc4ac647c1380a63b9d329b38a /lib/path.js
parentb0dd3bf499083214023da534e6cd0989f57dbecd (diff)
downloadandroid-node-v8-2db57bdecc9a0c3cedbd3883d9ee3e8a20232608.tar.gz
android-node-v8-2db57bdecc9a0c3cedbd3883d9ee3e8a20232608.tar.bz2
android-node-v8-2db57bdecc9a0c3cedbd3883d9ee3e8a20232608.zip
path: remove dead code in favor of unit tests
Remove dead code paths that are created by assertions that will never trigger. They may only trigger if either the `splitDeviceRe` or `splitPathRe` regular expressions are modified. If at some point they are modified, current unit tests will catch most of the resulting errors and this commit adds extra tests to catch the remaining errors. PR-URL: https://github.com/nodejs/io.js/pull/2282 Reviewed-By: Roman Reiss <me@silverwind.io>
Diffstat (limited to 'lib/path.js')
-rw-r--r--lib/path.js12
1 files changed, 1 insertions, 11 deletions
diff --git a/lib/path.js b/lib/path.js
index e0c5bcaa1c..78c61579ec 100644
--- a/lib/path.js
+++ b/lib/path.js
@@ -76,7 +76,7 @@ function win32SplitPath(filename) {
// Separate device+slash from tail
var result = splitDeviceRe.exec(filename),
device = (result[1] || '') + (result[2] || ''),
- tail = result[3] || '';
+ tail = result[3];
// Split the tail into dir, basename and extension
var result2 = splitTailRe.exec(tail),
dir = result2[1],
@@ -386,9 +386,6 @@ win32.parse = function(pathString) {
assertPath(pathString);
var allParts = win32SplitPath(pathString);
- if (!allParts || allParts.length !== 4) {
- throw new TypeError("Invalid path '" + pathString + "'");
- }
return {
root: allParts[0],
dir: allParts[0] + allParts[1].slice(0, -1),
@@ -590,13 +587,6 @@ posix.parse = function(pathString) {
assertPath(pathString);
var allParts = posixSplitPath(pathString);
- if (!allParts || allParts.length !== 4) {
- throw new TypeError("Invalid path '" + pathString + "'");
- }
- allParts[1] = allParts[1] || '';
- allParts[2] = allParts[2] || '';
- allParts[3] = allParts[3] || '';
-
return {
root: allParts[0],
dir: allParts[0] + allParts[1].slice(0, -1),