Skip to content

Commit

Permalink
test for invalid pattern input
Browse files Browse the repository at this point in the history
  • Loading branch information
Anthropohedron committed Apr 4, 2015
1 parent c2b2d54 commit 5274c1d
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions test/test-matcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,20 @@ exports["test create matcher"] = function(assert) {

exports["test create match no patterns"] = function(assert) {
assert.throws(function() {
new Matcher();
var matcher = new Matcher();
console.error("No patterns: ", matcher);
}, /no patterns/i, "No arguments to Matcher constructor");
assert.throws(function() {
new Matcher([]);
var matcher = new Matcher([]);
console.error("Empty patterns: ", matcher);
}, /no patterns/i, "Empty array passed to Matcher constructor");
}
};

exports["test create match invalid pattern"] = function(assert) {
assert.throws(function() {
var matcher = new Matcher([ "foo_" ]);
console.error("Invalid pattern: ", matcher);
}, /invalid pattern/i, "Invalid pattern passed to Matcher constructor");
};

require("sdk/test").run(exports);

0 comments on commit 5274c1d

Please sign in to comment.