Browse Source

test: add more path.basename() tests

PR-URL: https://github.com/nodejs/node/pull/6590
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
v7.x
Brian White 9 years ago
parent
commit
27549f64ce
No known key found for this signature in database GPG Key ID: 606D7358F94DA209
  1. 11
      test/parallel/test-path.js

11
test/parallel/test-path.js

@ -21,6 +21,17 @@ assert.equal(path.basename('aaa/bbb', 'bbb'), 'bbb');
assert.equal(path.basename('aaa/bbb//', 'bbb'), 'bbb');
assert.equal(path.basename('aaa/bbb', 'bb'), 'b');
assert.equal(path.basename('aaa/bbb', 'b'), 'bb');
assert.equal(path.basename('/aaa/bbb', '/bbb'), 'bbb');
assert.equal(path.basename('/aaa/bbb', 'a/bbb'), 'bbb');
assert.equal(path.basename('/aaa/bbb', 'bbb'), 'bbb');
assert.equal(path.basename('/aaa/bbb//', 'bbb'), 'bbb');
assert.equal(path.basename('/aaa/bbb', 'bb'), 'b');
assert.equal(path.basename('/aaa/bbb', 'b'), 'bb');
assert.equal(path.basename('/aaa/bbb'), 'bbb');
assert.equal(path.basename('/aaa/'), 'aaa');
assert.equal(path.basename('/aaa/b'), 'b');
assert.equal(path.basename('/a/b'), 'b');
assert.equal(path.basename('//a'), 'a');
// On Windows a backslash acts as a path separator.
assert.equal(path.win32.basename('\\dir\\basename.ext'), 'basename.ext');

Loading…
Cancel
Save