Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix the tokenizer unit tests. The `switch` unit test doesn't include …

…an error token, since the tokenizer doesn't validate statements.
  • Loading branch information...
commit 04b350c7ad565544a3e0e67e8807737f912834b3 1 parent 711ed5a
Kit Cambridge authored
Showing with 5 additions and 5 deletions.
  1. +4 −4 Tokenizer.js
  2. +1 −1  tests.js
View
8 Tokenizer.js
@@ -580,10 +580,10 @@ Tokenizer.testSuite = function(arr){
var fail = 0;
for (var i=0; i<arr.length; ++i) {
var test = arr[i], result;
- var input = test[1];
- var outputLen = test[2];
- var regexHints = test[4] ? test[3] : null; // if flags, then len=4
- var desc = test[4] || test[3];
+ var input = test[0];
+ var outputLen = test[1];
+ var regexHints = test[3] ? test[2] : null; // if flags, then len=4
+ var desc = test[3] || test[2];
var result = new Tokenizer(input).tokens(regexHints); // regexHints can be null, that's ok
if (result.length == outputLen) {
View
2  tests.js
@@ -475,6 +475,6 @@ var Tests = [
["/^(?:\\/(?![*\\n\\/])(?:\\[(?:\\\\.|[^\\]\\\\\\n])*\\]|\\\\.|[^\\[\\/\\\\\\n])+\\/[gim]*)$/", 1, [true], "Complex RegExp for Matching RegExps"],
["({a:b}[ohi].iets()++);", 16, "Object Literal With 1 Member, Square Bracket Member Accessor, Dot Member Accessor, Function Call, Postfix Increment"],
-["switch(x){ default: foo; break; case x: break; default: fail; }", 31, "double default should include error token (30+1)"]
+["switch(x){ default: foo; break; case x: break; default: fail; }", 30, "double default should include error token (30+1)"]
];
Please sign in to comment.
Something went wrong with that request. Please try again.