From c5ef358423479b62534a791f3565b4119b32b344 Mon Sep 17 00:00:00 2001 From: lakatostamas Date: Thu, 22 Nov 2018 14:27:39 +0100 Subject: [PATCH] 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. --- test/parallel/test-path-makelong.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/parallel/test-path-makelong.js b/test/parallel/test-path-makelong.js index 01c81b47502f4e..b0a4ebc6b30b62 100644 --- a/test/parallel/test-path-makelong.js +++ b/test/parallel/test-path-makelong.js @@ -43,6 +43,7 @@ if (common.isWindows) { '\\\\.\\pipe\\somepipe'); } +assert.strictEqual(path.toNamespacedPath(''), ''); assert.strictEqual(path.toNamespacedPath(null), null); assert.strictEqual(path.toNamespacedPath(100), 100); assert.strictEqual(path.toNamespacedPath(path), path); @@ -60,6 +61,7 @@ assert.strictEqual(path.posix.toNamespacedPath(emptyObj), emptyObj); if (common.isWindows) { // These tests cause resolve() to insert the cwd, so we cannot test them from // non-Windows platforms (easily) + assert.strictEqual(path.toNamespacedPath(''), ''); assert.strictEqual(path.win32.toNamespacedPath('foo\\bar').toLowerCase(), `\\\\?\\${process.cwd().toLowerCase()}\\foo\\bar`); assert.strictEqual(path.win32.toNamespacedPath('foo/bar').toLowerCase(),