mirror of
https://github.com/nodejs/node.git
synced 2026-11-26 21:58:26 -05:00
test: cover path.basename when path and ext are the same
In path.basename was a case when the path and the extension is the same and this wasn't covered with tests. I covered this case both in Windows and Unix environments. PR-URL: https://github.com/nodejs/node/pull/24570 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
1 parent
b219131bb8
commit
f371321bd2
1 file changed
+2
@@ -29,6 +29,7 @@ assert.strictEqual(path.basename('/aaa/'), 'aaa');
|
||||
assert.strictEqual(path.basename('/aaa/b'), 'b');
|
||||
assert.strictEqual(path.basename('/a/b'), 'b');
|
||||
assert.strictEqual(path.basename('//a'), 'a');
|
||||
assert.strictEqual(path.basename('a', 'a'), '');
|
||||
|
||||
// On Windows a backslash acts as a path separator.
|
||||
assert.strictEqual(path.win32.basename('\\dir\\basename.ext'), 'basename.ext');
|
||||
@@ -53,6 +54,7 @@ assert.strictEqual(path.win32.basename('C:basename.ext\\'), 'basename.ext');
|
||||
assert.strictEqual(path.win32.basename('C:basename.ext\\\\'), 'basename.ext');
|
||||
assert.strictEqual(path.win32.basename('C:foo'), 'foo');
|
||||
assert.strictEqual(path.win32.basename('file:stream'), 'file:stream');
|
||||
assert.strictEqual(path.win32.basename('a', 'a'), '');
|
||||
|
||||
// On unix a backslash is just treated as any other character.
|
||||
assert.strictEqual(path.posix.basename('\\dir\\basename.ext'),
|
||||
|
||||
Reference in new issue
Block a user