diff --git a/test/api.isMatch.js b/test/api.isMatch.js index e68c5ec1..2e149fbe 100644 --- a/test/api.isMatch.js +++ b/test/api.isMatch.js @@ -165,11 +165,20 @@ describe('.isMatch():', function() { assert(!mm.isMatch('a/z.js', 'a/b/**/*.js')); assert(!mm.isMatch('z.js', 'a/b/**/*.js')); - // issue #23 + // https://github.com/micromatch/micromatch/issues/15 + assert(mm.isMatch('z.js', 'z*')); + assert(mm.isMatch('z.js', '**/z*')); + assert(mm.isMatch('z.js', '**/z*.js')); + assert(mm.isMatch('z.js', '**/*.js')); + assert(mm.isMatch('foo', '**/foo')); + }); + + it('issue #23', function() { assert(!mm.isMatch('zzjs', 'z*.js')); assert(!mm.isMatch('zzjs', '*z.js')); + }); - // issue #24 + it('issue #24', function() { assert(mm.isMatch('a', '**')); assert(!mm.isMatch('a', 'a/**')); assert(mm.isMatch('a/', '**')); @@ -188,14 +197,6 @@ describe('.isMatch():', function() { assert(mm.isMatch('a/b/c/d/e.f', 'a/b/**/d/**/*.*')); assert(mm.isMatch('a/b/c/d/g/e.f', 'a/b/**/d/**/*.*')); assert(mm.isMatch('a/b/c/d/g/g/e.f', 'a/b/**/d/**/*.*')); - - // https://github.com/micromatch/micromatch/issues/15 - assert(mm.isMatch('z.js', 'z*')); - assert(mm.isMatch('z.js', '**/z*')); - assert(mm.isMatch('z.js', '**/z*.js')); - assert(mm.isMatch('z.js', '**/*.js')); - assert(mm.isMatch('foo', '**/foo')); - assert(mm.isMatch('a/b-c/z.js', 'a/b-*/**/z.js')); assert(mm.isMatch('a/b-c/d/e/z.js', 'a/b-*/**/z.js')); }); diff --git a/test/extglobs.js b/test/extglobs.js index 6c27a82c..a725996e 100644 --- a/test/extglobs.js +++ b/test/extglobs.js @@ -17,6 +17,20 @@ describe('extglobs', function() { path.sep = sep; }); + it('should match extglobs with wildcards (issue #100)', function() { + mm(['foo/bar/baz.jsx'], 'foo/bar/*.+(js|jsx)', ['foo/bar/baz.jsx']); + mm(['foo/bar/baz.jsx'], 'foo/bar/**/*.+(js|jsx)', ['foo/bar/baz.jsx']); + mm(['foo.txt'], '**/!(bar).txt', ['foo.txt']); + mm(['a/dir/foo.txt'], '*/dir/**/!(bar).txt', ['a/dir/foo.txt']); + mm(['a/b/c.txt', 'a/b/cc.txt'], '*/b/!(c).txt', []); + mm(['a/b/c.txt', 'a/b/cc.txt'], '*/b/!(*).txt', []); + mm(['a/b/c.txt', 'a/b/cc.txt'], '*/b/!(cc).txt', ['a/b/c.txt']); + mm(['b/c', 'b/cc'], 'b/!(cc)', ['b/c']); + mm(['b/c', 'b/ccc', 'b/cc'], 'b/!(c)', ['b/cc', 'b/ccc']); + mm(['b/c.txt', 'b/cc.txt'], 'b/!(cc).txt', ['b/c.txt']); + mm(['b/c.txt', 'b/cc.txt'], 'b/!(c).txt', []); + }); + it('should match extglobs ending with statechar', function() { // from minimatch tests assert(!mm.isMatch('ax', 'a?(b*)')); @@ -49,13 +63,6 @@ describe('extglobs', function() { mm(['a.js', 'a.txt', 'a.md'], 'a.!(js)*', ['a.md', 'a.txt']); }); - it('handles extglobs and patterns, issues 100, 102, 103', function() { - mm(['foo/MyDir/MyFile.jsx'], 'foo/MyDir/**/*.+(js|jsx)', ['foo/MyDir/MyFile.jsx']); - mm(['file.txt'], '**/!(folder).txt', ['file.txt']); - mm(['a/dir/file.txt'], '*/dir/**/!(folder).txt', ['a/dir/file.txt']); - mm(['a/b/c.txt', 'a/b/cc.txt'], '*/b/!(c).txt', ['a/b/cc.txt']); - }); - it('should support negation', function() { var arr = ['a', 'b', 'aa', 'ab', 'bb', 'ac', 'aaa', 'aab', 'abb', 'ccc']; mm(arr, '!(a)*', ['b', 'bb', 'ccc']);