From 4201cb483b8172fb4af02450aeac483709b2901c Mon Sep 17 00:00:00 2001 From: Jon Schlinkert Date: Thu, 24 Mar 2022 15:22:22 -0400 Subject: [PATCH] fix windows tests the `api.matcher.js` tests were for posix and should have been skipped on windows. --- test/api.matcher.js | 1 + test/bash.js | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/test/api.matcher.js b/test/api.matcher.js index 1bd8f30c..7299063c 100644 --- a/test/api.matcher.js +++ b/test/api.matcher.js @@ -83,6 +83,7 @@ describe('.matcher()', () => { }); describe('backlashes for path separators, on posix', () => { + if (process.platform === 'win32') return; let format = str => str; it('should return an array of matches for a literal string', () => { diff --git a/test/bash.js b/test/bash.js index 927dd475..9e088992 100644 --- a/test/bash.js +++ b/test/bash.js @@ -9,7 +9,7 @@ const isWindows = () => process.platform === 'win32' || path.sep === '\\'; const format = str => str.replace(/\\/g, '/').replace(/^\.\//, ''); // from the Bash 4.3 specification/unit tests -const fixtures = ['*', '**', '\\*', 'a', 'a/*', 'abc', 'abd', 'abe', 'b', 'bb', 'bcd', 'bdir/', 'Beware', 'c', 'ca', 'cb', 'd', 'dd', 'de']; +const fixtures = ['\\\\', '*', '**', '\\*', 'a', 'a/*', 'abc', 'abd', 'abe', 'b', 'bb', 'bcd', 'bdir/', 'Beware', 'c', 'ca', 'cb', 'd', 'dd', 'de']; describe('bash options and features:', () => { // $echo a/{1..3}/b @@ -77,13 +77,13 @@ describe('bash options and features:', () => { // should not match backslashes on windows, since backslashes are path // separators and negation character classes should not match path separators // unless it's explicitly defined in the character class - assert.deepEqual(mm(f, '[^a-c]*'), ['d', 'dd', 'de', 'Beware', 'BewAre', 'BZZ', '*', '**'].sort()); - assert.deepEqual(mm(f, '[^a-c]*', { bash: false }), ['d', 'dd', 'de', 'BewAre', 'Beware', 'BZZ', '*', '**'].sort()); - assert.deepEqual(mm(f, '[^a-c]*', { nocase: true }), ['d', 'dd', 'de', '*', '**'].sort()); + assert.deepEqual(mm(f, '[^a-c]*'), ['d', 'dd', 'de', 'Beware', 'BewAre', 'BZZ', '*', '**', '\\*'].sort()); + assert.deepEqual(mm(f, '[^a-c]*', { bash: false }), ['d', 'dd', 'de', 'BewAre', 'Beware', 'BZZ', '*', '**', '\\*'].sort()); + assert.deepEqual(mm(f, '[^a-c]*', { nocase: true }), ['d', 'dd', 'de', '*', '**', '\\*'].sort()); } else { - assert.deepEqual(mm(f, '[^a-c]*'), ['*', '**', 'BZZ', 'BewAre', 'Beware', '\\*', 'd', 'dd', 'de'].sort()); - assert.deepEqual(mm(f, '[^a-c]*', { bash: false }), ['*', '**', 'BZZ', 'BewAre', 'Beware', '\\*', 'd', 'dd', 'de'].sort()); - assert.deepEqual(mm(f, '[^a-c]*', { nocase: true }), ['*', '**', '\\*', 'd', 'dd', 'de'].sort()); + assert.deepEqual(mm(f, '[^a-c]*'), ['*', '**', 'BZZ', 'BewAre', 'Beware', '\\*', 'd', 'dd', 'de', '\\\\'].sort()); + assert.deepEqual(mm(f, '[^a-c]*', { bash: false }), ['*', '**', 'BZZ', 'BewAre', 'Beware', '\\*', 'd', 'dd', 'de', '\\\\'].sort()); + assert.deepEqual(mm(f, '[^a-c]*', { nocase: true }), ['*', '**', '\\*', 'd', 'dd', 'de', '\\\\'].sort()); } });