Skip to content

Commit

Permalink
path: fixing a test that breaks on some machines.
Browse files Browse the repository at this point in the history
A win32-only test was verifying that path.win32._makeLong('C:')
would return the current working directory.  This would only work if
current working directory was also on the C: device.  Fix is to grab
the device letter for current working directory, and pass that to
_makeLong().

PR-URL: #6067
Reviewed-By: Trott - Rich Trott <[email protected]>
Reviewed-By: Joao Reis <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Johan Bergström <[email protected]>
  • Loading branch information
Mike Kaufman authored and Myles Borins committed Apr 20, 2016
1 parent 820dd58 commit b9ac6b0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/parallel/test-path.js
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,8 @@ if (common.isWindows) {
'\\\\?\\' + process.cwd().toLowerCase() + '\\foo\\bar');
assert.equal(path.win32._makeLong('foo/bar').toLowerCase(),
'\\\\?\\' + process.cwd().toLowerCase() + '\\foo\\bar');
assert.equal(path.win32._makeLong('C:').toLowerCase(),
const currentDeviceLetter = path.parse(process.cwd()).root.substring(0, 2);
assert.equal(path.win32._makeLong(currentDeviceLetter).toLowerCase(),
'\\\\?\\' + process.cwd().toLowerCase());
assert.equal(path.win32._makeLong('C').toLowerCase(),
'\\\\?\\' + process.cwd().toLowerCase() + '\\c');
Expand Down

0 comments on commit b9ac6b0

Please sign in to comment.