From 0e26031df51c36f9273cb93101f52821a9d3a877 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Fri, 26 Aug 2016 21:12:59 -0700 Subject: [PATCH] test: add known issue test for path parse issue #6229 Refs: https://github.com/nodejs/node/issues/6229 PR-URL: https://github.com/nodejs/node/pull/8293 Reviewed-By: Colin Ihrig Reviewed-By: Rich Trott --- test/known_issues/test-path-parse-6229.js | 34 +++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 test/known_issues/test-path-parse-6229.js diff --git a/test/known_issues/test-path-parse-6229.js b/test/known_issues/test-path-parse-6229.js new file mode 100644 index 00000000000000..5096a97333159d --- /dev/null +++ b/test/known_issues/test-path-parse-6229.js @@ -0,0 +1,34 @@ +'use strict'; +// Refs: https://github.com/nodejs/node/issues/6229 + +require('../common'); +const assert = require('assert'); +const path = require('path'); + +{ + // The path `/foo/bar` is not the same path as `/foo/bar/` + const parsed1 = path.posix.parse('/foo/bar'); + const parsed2 = path.posix.parse('/foo/bar/'); + + assert.strictEqual(parsed1.root, '/'); + assert.strictEqual(parsed1.dir, '/foo'); + assert.strictEqual(parsed1.base, 'bar'); + + assert.strictEqual(parsed2.root, '/'); + assert.strictEqual(parsed2.dir, '/foo/bar'); + assert.strictEqual(parsed2.base, ''); +} + +{ + // The path `\\foo\\bar` is not the same path as `\\foo\\bar\\` + const parsed1 = path.win32.parse('\\foo\\bar'); + const parsed2 = path.win32.parse('\\foo\\bar\\'); + + assert.strictEqual(parsed1.root, '\\'); + assert.strictEqual(parsed1.dir, '\\foo'); + assert.strictEqual(parsed1.base, 'bar'); + + assert.strictEqual(parsed2.root, '\\'); + assert.strictEqual(parsed2.dir, '\\foo\\bar'); + assert.strictEqual(parsed2.base, ''); +}