Skip to content

Commit 288a421

Browse files
lakatostamasBethGriggs
authored andcommitted
test: cover path empty string case
In path.toNamespacePath was a case when the path was empty string and it wasn't covered in the tests. I covered this case both in Windows and Unix environments. PR-URL: #24569 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent ef68349 commit 288a421

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

test/parallel/test-path-makelong.js

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ if (common.isWindows) {
4343
'\\\\.\\pipe\\somepipe');
4444
}
4545

46+
assert.strictEqual(path.toNamespacedPath(''), '');
4647
assert.strictEqual(path.toNamespacedPath(null), null);
4748
assert.strictEqual(path.toNamespacedPath(100), 100);
4849
assert.strictEqual(path.toNamespacedPath(path), path);
@@ -60,6 +61,7 @@ assert.strictEqual(path.posix.toNamespacedPath(emptyObj), emptyObj);
6061
if (common.isWindows) {
6162
// These tests cause resolve() to insert the cwd, so we cannot test them from
6263
// non-Windows platforms (easily)
64+
assert.strictEqual(path.toNamespacedPath(''), '');
6365
assert.strictEqual(path.win32.toNamespacedPath('foo\\bar').toLowerCase(),
6466
`\\\\?\\${process.cwd().toLowerCase()}\\foo\\bar`);
6567
assert.strictEqual(path.win32.toNamespacedPath('foo/bar').toLowerCase(),

0 commit comments

Comments
 (0)