Skip to content
This repository

Pullreq 7 - assert.throws isn't someone very special; address it like all the other assert.xyz methods. #145

Merged
merged 2 commits into from about 1 year ago

2 participants

Ger Hobbelt Zach Carter
Ger Hobbelt

See also the commit message itself. I saw that there was a lot hiding under the rug in #143 due to the git merge process I use; here's the manual extract of most of the goodies. (The submodules/makefile work is not included as that's probably too much 'It Works Here(tm)' now)


  • assert.throws isn't someone very special; address it like all the other assert.xyz methods.
Zach Carter
Owner

Good 'ol remnants of ES3.

Zach Carter zaach merged commit 40d7bf6 into from February 16, 2013
Zach Carter zaach closed this February 16, 2013
Ger Hobbelt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
4  .gitignore
... ...
@@ -1,2 +1,6 @@
1 1
 .DS_Store
2 2
 node_modules
  3
+
  4
+# Editor backup files
  5
+*.bak
  6
+*~
8  tests/parser/api.js
@@ -97,7 +97,7 @@ exports["test start symbol should be nonterminal"] = function () {
97 97
         }
98 98
     };
99 99
 
100  
-    assert["throws"](function(){new Jison.Generator(grammar);}, "throws error");
  100
+    assert.throws(function(){new Jison.Generator(grammar);}, "throws error");
101 101
 };
102 102
 
103 103
 exports["test token list as string"] = function () {
@@ -220,7 +220,7 @@ exports["test custom parse error method"] = function () {
220 220
         throw str;
221 221
     };
222 222
 
223  
-    assert["throws"](function () {parser.parse("aga")});
  223
+    assert.throws(function () {parser.parse("aga")});
224 224
     assert.strictEqual(result.text, "a", "parse error text should equal b");
225 225
     assert.strictEqual(typeof result.token, 'string', "parse error token should be a string");
226 226
     assert.strictEqual(result.line, 0, "hash should include line number");
@@ -251,7 +251,7 @@ exports["test no default resolve"] = function () {
251 251
 
252 252
     assert.ok(gen.table.length == 4, "table has 4 states");
253 253
     assert.ok(gen.conflicts == 2, "encountered 2 conflicts");
254  
-    assert["throws"](function () {parser.parse("xx")}, "throws parse error for multiple actions");
  254
+    assert.throws(function () {parser.parse("xx")}, "throws parse error for multiple actions");
255 255
 };
256 256
 
257 257
 
@@ -270,7 +270,7 @@ exports["test EOF in 'Unexpected token' error message"] = function () {
270 270
         assert.ok(str.match("end of input"));
271 271
     };
272 272
 
273  
-    assert['throws'](function () {parser.parse("xx"); });
  273
+    assert.throws(function () {parser.parse("xx"); });
274 274
 
275 275
 };
276 276
 
6  tests/parser/errorlab.js
@@ -91,7 +91,7 @@ exports["test no recovery"] = function () {
91 91
 
92 92
     var parser = new Jison.Parser(grammar, {type: "lr0"});
93 93
     parser.lexer = new Lexer(lexData);
94  
-    assert["throws"](function (){parser.parse('xxgy')}, "should throw");
  94
+    assert.throws(function (){parser.parse('xxgy')}, "should throw");
95 95
 };
96 96
 
97 97
 exports["test error after error recovery"] = function () {
@@ -115,7 +115,7 @@ exports["test error after error recovery"] = function () {
115 115
 
116 116
     var parser = new Jison.Parser(grammar, {type: "lr0"});
117 117
     parser.lexer = new Lexer(lexData);
118  
-    assert["throws"](function (){parser.parse('gxxx;')}, "should return bar");
  118
+    assert.throws(function (){parser.parse('gxxx;')}, "should return bar");
119 119
 };
120 120
 
121 121
 exports["test throws error despite recovery rule"] = function() {
@@ -144,7 +144,7 @@ exports["test throws error despite recovery rule"] = function() {
144 144
 
145 145
     var expectedAST = ["+", ["+", [0], [0]], [0]];
146 146
 
147  
-    assert['throws'](function (){(parser.parse("0+0+0>"), expectedAST);});
  147
+    assert.throws(function (){(parser.parse("0+0+0>"), expectedAST);});
148 148
 };
149 149
 
150 150
 exports["test correct AST after error recovery abrupt end"] = function() {
4  tests/parser/lalr.js
@@ -25,7 +25,7 @@ exports["test 0+0 grammar"] = function () {
25 25
     assert.ok(parser.parse("0+0+0"), "parse");
26 26
     assert.ok(parser.parse("0"), "parse single 0");
27 27
 
28  
-    assert["throws"](function () {parser.parse("+")}, "throws parse error on invalid");
  28
+    assert.throws(function () {parser.parse("+")}, "throws parse error on invalid");
29 29
 };
30 30
 
31 31
 exports["test xx nullable grammar"] = function () {
@@ -48,7 +48,7 @@ exports["test xx nullable grammar"] = function () {
48 48
 
49 49
     assert.ok(parser.parse("xxx"), "parse");
50 50
     assert.ok(parser.parse("x"), "parse single x");
51  
-    assert["throws"](function (){parser.parse("+");}, "throws parse error on invalid");
  51
+    assert.throws(function (){parser.parse("+");}, "throws parse error on invalid");
52 52
 };
53 53
 
54 54
 exports["test LALR algorithm from Bermudez, Logothetis"] = function () {
4  tests/parser/lr0.js
@@ -25,7 +25,7 @@ exports["test left-recursive nullable grammar"] = function () {
25 25
 
26 26
     assert.ok(parser.parse('xxx'), "parse 3 x's");
27 27
     assert.ok(parser.parse("x"),   "parse single x");
28  
-    assert["throws"](function () {parser.parse("y")},  "throws parse error on invalid token");
  28
+    assert.throws(function () {parser.parse("y")},  "throws parse error on invalid token");
29 29
 };
30 30
 
31 31
 exports["test right-recursive nullable grammar"] = function () {
@@ -68,5 +68,5 @@ exports["test 0+0 grammar"] = function () {
68 68
     assert.ok(parser.parse("0+0+0"), "parse");
69 69
     assert.ok(parser.parse("0"), "parse single 0");
70 70
 
71  
-    assert["throws"](function () {parser.parse("+")}, "throws parse error on invalid");
  71
+    assert.throws(function () {parser.parse("+")}, "throws parse error on invalid");
72 72
 };
2  tests/parser/lr1.js
@@ -23,7 +23,7 @@ exports["test xx nullable grammar"] = function () {
23 23
 
24 24
     assert.ok(parser.parse("xxx"), "parse");
25 25
     assert.ok(parser.parse("x"), "parse single x");
26  
-    assert["throws"](function (){parser.parse("+");}, "throws parse error on invalid");
  26
+    assert.throws(function (){parser.parse("+");}, "throws parse error on invalid");
27 27
 };
28 28
 
29 29
 exports["test LR parse"] = function () {
2  tests/parser/precedence.js
@@ -160,7 +160,7 @@ exports["test Non-associative operator"] = function () {
160 160
     var parser = new Jison.Parser(grammar, {type: "lalr"});
161 161
     parser.lexer = new RegExpLexer(lexData);
162 162
 
163  
-    assert["throws"](function () {parser.parse("x=x=x");}, "throws parse error when operator used twice.");
  163
+    assert.throws(function () {parser.parse("x=x=x");}, "throws parse error when operator used twice.");
164 164
     assert.ok(parser.parse("x=x"), "normal use is okay.");
165 165
 };
166 166
 
2  tests/parser/slr.js
@@ -26,7 +26,7 @@ exports["test left-recursive nullable grammar"] = function () {
26 26
 
27 27
     assert.ok(parser.parse('xxx'), "parse 3 x's");
28 28
     assert.ok(parser.parse("x"), "parse single x");
29  
-    assert["throws"](function(){parser.parse("y")}, "throws parse error on invalid token");
  29
+    assert.throws(function(){parser.parse("y")}, "throws parse error on invalid token");
30 30
     assert.ok(gen.conflicts == 0, "no conflicts");
31 31
 };
32 32
 
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.