Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add known issue test for path parse issue #6229 #8293

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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, '');
}