Skip to content

Commit

Permalink
Add test for negating matches in non-globs
Browse files Browse the repository at this point in the history
  • Loading branch information
es128 committed Apr 18, 2015
1 parent e151ef5 commit 6ec1860
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ describe('anymatch', function() {
});

describe('glob negation', function() {
after(matchers.pop.bind(matchers));
after(matchers.splice.bind(matchers, 4, 2));
it('should respect negated globs included in a matcher array', function() {
assert(anymatch(matchers, 'path/anyjs/no/no.js'), 'matches existing glob');
matchers.push('!path/anyjs/no/*.js');
Expand All @@ -148,6 +148,11 @@ describe('anymatch', function() {
assert.equal(anymatch(matchers, 'path/anyjs/no/no.js', true), -1);
assert.equal(anymatch(matchers)('path/anyjs/no/no.js', true), -1);
});
it('should allow negated globs to negate non-glob matchers', function() {
assert.equal(anymatch(matchers, 'path/to/bar.js', true), 3);
matchers.push('!path/to/bar.*');
assert(!anymatch(matchers, 'path/to/bar.js'));
});
});

describe('windows paths', function() {
Expand Down

0 comments on commit 6ec1860

Please sign in to comment.