0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/known_issues/test-path-parse-6229.js
James M Snell 407069a29d 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 <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2016-08-29 15:15:18 -07:00

35 lines
1008 B
JavaScript

'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, '');
}