Permalink
Browse files

assert.throws isn't someone very special; address it like all the oth…

…er assert.xyz methods.
  • Loading branch information...
1 parent 17f8d26 commit f59ee4f4fb397f3563fd6f46c122dc0dbb46077c @GerHobbelt GerHobbelt committed Feb 16, 2013
Showing with 14 additions and 14 deletions.
  1. +4 −4 tests/parser/api.js
  2. +3 −3 tests/parser/errorlab.js
  3. +2 −2 tests/parser/lalr.js
  4. +2 −2 tests/parser/lr0.js
  5. +1 −1 tests/parser/lr1.js
  6. +1 −1 tests/parser/precedence.js
  7. +1 −1 tests/parser/slr.js
View
@@ -97,7 +97,7 @@ exports["test start symbol should be nonterminal"] = function () {
}
};
- assert["throws"](function(){new Jison.Generator(grammar);}, "throws error");
+ assert.throws(function(){new Jison.Generator(grammar);}, "throws error");
};
exports["test token list as string"] = function () {
@@ -220,7 +220,7 @@ exports["test custom parse error method"] = function () {
throw str;
};
- assert["throws"](function () {parser.parse("aga")});
+ assert.throws(function () {parser.parse("aga")});
assert.strictEqual(result.text, "a", "parse error text should equal b");
assert.strictEqual(typeof result.token, 'string', "parse error token should be a string");
assert.strictEqual(result.line, 0, "hash should include line number");
@@ -251,7 +251,7 @@ exports["test no default resolve"] = function () {
assert.ok(gen.table.length == 4, "table has 4 states");
assert.ok(gen.conflicts == 2, "encountered 2 conflicts");
- assert["throws"](function () {parser.parse("xx")}, "throws parse error for multiple actions");
+ assert.throws(function () {parser.parse("xx")}, "throws parse error for multiple actions");
};
@@ -270,7 +270,7 @@ exports["test EOF in 'Unexpected token' error message"] = function () {
assert.ok(str.match("end of input"));
};
- assert['throws'](function () {parser.parse("xx"); });
+ assert.throws(function () {parser.parse("xx"); });
};
View
@@ -91,7 +91,7 @@ exports["test no recovery"] = function () {
var parser = new Jison.Parser(grammar, {type: "lr0"});
parser.lexer = new Lexer(lexData);
- assert["throws"](function (){parser.parse('xxgy')}, "should throw");
+ assert.throws(function (){parser.parse('xxgy')}, "should throw");
};
exports["test error after error recovery"] = function () {
@@ -115,7 +115,7 @@ exports["test error after error recovery"] = function () {
var parser = new Jison.Parser(grammar, {type: "lr0"});
parser.lexer = new Lexer(lexData);
- assert["throws"](function (){parser.parse('gxxx;')}, "should return bar");
+ assert.throws(function (){parser.parse('gxxx;')}, "should return bar");
};
exports["test throws error despite recovery rule"] = function() {
@@ -144,7 +144,7 @@ exports["test throws error despite recovery rule"] = function() {
var expectedAST = ["+", ["+", [0], [0]], [0]];
- assert['throws'](function (){(parser.parse("0+0+0>"), expectedAST);});
+ assert.throws(function (){(parser.parse("0+0+0>"), expectedAST);});
};
exports["test correct AST after error recovery abrupt end"] = function() {
View
@@ -25,7 +25,7 @@ exports["test 0+0 grammar"] = function () {
assert.ok(parser.parse("0+0+0"), "parse");
assert.ok(parser.parse("0"), "parse single 0");
- assert["throws"](function () {parser.parse("+")}, "throws parse error on invalid");
+ assert.throws(function () {parser.parse("+")}, "throws parse error on invalid");
};
exports["test xx nullable grammar"] = function () {
@@ -48,7 +48,7 @@ exports["test xx nullable grammar"] = function () {
assert.ok(parser.parse("xxx"), "parse");
assert.ok(parser.parse("x"), "parse single x");
- assert["throws"](function (){parser.parse("+");}, "throws parse error on invalid");
+ assert.throws(function (){parser.parse("+");}, "throws parse error on invalid");
};
exports["test LALR algorithm from Bermudez, Logothetis"] = function () {
View
@@ -25,7 +25,7 @@ exports["test left-recursive nullable grammar"] = function () {
assert.ok(parser.parse('xxx'), "parse 3 x's");
assert.ok(parser.parse("x"), "parse single x");
- assert["throws"](function () {parser.parse("y")}, "throws parse error on invalid token");
+ assert.throws(function () {parser.parse("y")}, "throws parse error on invalid token");
};
exports["test right-recursive nullable grammar"] = function () {
@@ -68,5 +68,5 @@ exports["test 0+0 grammar"] = function () {
assert.ok(parser.parse("0+0+0"), "parse");
assert.ok(parser.parse("0"), "parse single 0");
- assert["throws"](function () {parser.parse("+")}, "throws parse error on invalid");
+ assert.throws(function () {parser.parse("+")}, "throws parse error on invalid");
};
View
@@ -23,7 +23,7 @@ exports["test xx nullable grammar"] = function () {
assert.ok(parser.parse("xxx"), "parse");
assert.ok(parser.parse("x"), "parse single x");
- assert["throws"](function (){parser.parse("+");}, "throws parse error on invalid");
+ assert.throws(function (){parser.parse("+");}, "throws parse error on invalid");
};
exports["test LR parse"] = function () {
@@ -160,7 +160,7 @@ exports["test Non-associative operator"] = function () {
var parser = new Jison.Parser(grammar, {type: "lalr"});
parser.lexer = new RegExpLexer(lexData);
- assert["throws"](function () {parser.parse("x=x=x");}, "throws parse error when operator used twice.");
+ assert.throws(function () {parser.parse("x=x=x");}, "throws parse error when operator used twice.");
assert.ok(parser.parse("x=x"), "normal use is okay.");
};
View
@@ -26,7 +26,7 @@ exports["test left-recursive nullable grammar"] = function () {
assert.ok(parser.parse('xxx'), "parse 3 x's");
assert.ok(parser.parse("x"), "parse single x");
- assert["throws"](function(){parser.parse("y")}, "throws parse error on invalid token");
+ assert.throws(function(){parser.parse("y")}, "throws parse error on invalid token");
assert.ok(gen.conflicts == 0, "no conflicts");
};

0 comments on commit f59ee4f

Please sign in to comment.