Skip to content

Commit

Permalink
test: fix redeclared test-path vars
Browse files Browse the repository at this point in the history
PR-URL: #4991
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Roman Klauke <romaaan.git@gmail.com>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
Trott authored and rvagg committed Feb 8, 2016
1 parent b16b360 commit 51fb884
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions test/parallel/test-path.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,10 @@ assert.equal(path.posix.normalize('a//b//./c'), 'a/b/c');
assert.equal(path.posix.normalize('a//b//.'), 'a/b');

// path.resolve tests
var resolveTests;
if (common.isWindows) {
// windows
var resolveTests =
resolveTests =
// arguments result
[[['c:/blah\\blah', 'd:/games', 'c:../a'], 'c:\\blah\\a'],
[['c:/ignore', 'd:\\a/b\\c/d', '\\e.exe'], 'd:\\e.exe'],
Expand All @@ -322,15 +323,15 @@ if (common.isWindows) {
];
} else {
// Posix
var resolveTests =
resolveTests =
// arguments result
[[['/var/lib', '../', 'file/'], '/var/file'],
[['/var/lib', '/../', 'file/'], '/file'],
[['a/b/c/', '../../..'], process.cwd()],
[['.'], process.cwd()],
[['/some/dir', '.', '/absolute/'], '/absolute']];
}
var failures = [];
failures = [];
resolveTests.forEach(function(test) {
var actual = path.resolve.apply(path, test[0]);
var expected = test[1];
Expand Down Expand Up @@ -358,9 +359,10 @@ assert.equal(path.posix.isAbsolute('bar/'), false);
assert.equal(path.posix.isAbsolute('./baz'), false);

// path.relative tests
var relativeTests;
if (common.isWindows) {
// windows
var relativeTests =
relativeTests =
// arguments result
[['c:/blah\\blah', 'd:/games', 'd:\\games'],
['c:/aaaa/bbbb', 'c:/aaaa', '..'],
Expand All @@ -372,7 +374,7 @@ if (common.isWindows) {
['c:/aaaa/bbbb', 'd:\\', 'd:\\']];
} else {
// posix
var relativeTests =
relativeTests =
// arguments result
[['/var/lib', '/var', '..'],
['/var/lib', '/bin', '../../bin'],
Expand All @@ -381,7 +383,7 @@ if (common.isWindows) {
['/var/', '/var/lib', 'lib'],
['/', '/var/lib', 'var/lib']];
}
var failures = [];
failures = [];
relativeTests.forEach(function(test) {
var actual = path.relative(test[0], test[1]);
var expected = test[2];
Expand Down

0 comments on commit 51fb884

Please sign in to comment.