From 27549f64cea9b4822cc9e39e2d88b2481ca012a9 Mon Sep 17 00:00:00 2001 From: Brian White Date: Tue, 10 May 2016 10:26:50 -0400 Subject: [PATCH] test: add more path.basename() tests PR-URL: https://github.com/nodejs/node/pull/6590 Reviewed-By: James M Snell Reviewed-By: Evan Lucas --- test/parallel/test-path.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/parallel/test-path.js b/test/parallel/test-path.js index 503a1cbca6..5aa60eb7c6 100644 --- a/test/parallel/test-path.js +++ b/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');