Skip to content

Commit

Permalink
test: add known issue test for path parse issue #6229
Browse files Browse the repository at this point in the history
Refs: #6229
PR-URL: #8293
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
jasnell authored and Fishrock123 committed Sep 9, 2016

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
1 parent 836bfc1 commit 5d43131
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions test/known_issues/test-path-parse-6229.js
Original file line number Diff line number Diff line change
@@ -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, '');
}

0 comments on commit 5d43131

Please sign in to comment.