Permalink
Browse files

No issue: fix tests to respect Too Many Errors and Unrecoverable Synt…

…ax Error situations
  • Loading branch information...
1 parent 9e29aae commit fde6c19075d59749778e42fb39c8470e4e9948a5 @valueof valueof committed Jan 27, 2014
Showing with 20 additions and 5 deletions.
  1. +5 −2 tests/unit/core.js
  2. +1 −0 tests/unit/options.js
  3. +14 −3 tests/unit/parser.js
View
@@ -310,7 +310,9 @@ exports.returnStatement = function (test) {
TestRun(test)
.addError(3, "Did you mean to return a conditional instead of an assignment?")
.addError(38, "Line breaking error 'return'.")
- .test(src, { es3: true, maxerr: 2 });
+ .addError(38, "Missing semicolon.")
+ .addError(39, "Unnecessary semicolon.")
+ .test(src, { es3: true });
test.done();
};
@@ -416,7 +418,8 @@ exports.noExcOnTooManyUndefined = function (test) {
TestRun(test)
.addError(1, "'a' is not defined.")
- .test(code, { es3: true, undef: true, maxerr: 1 });
+ .addError(1, "'b' is not defined.")
+ .test(code, { es3: true, undef: true });
test.done();
};
View
@@ -980,6 +980,7 @@ exports.passfail = function (test) {
TestRun(test)
.addError(1, "Missing semicolon.")
+ .addError(1, "Stopping. (33% scanned).")
.test(code, { es3: true, passfail: true });
test.done();
View
@@ -31,11 +31,13 @@ exports.other = function (test) {
.addError(1, "Unexpected '\\'.")
.addError(2, "Unexpected early end of program.")
.addError(2, "Expected an identifier and instead saw '(end)'.")
+ .addError(2, "Unrecoverable syntax error. (100% scanned).")
.test(code, {es3: true});
// GH-818
TestRun(test)
.addError(1, "Expected an identifier and instead saw ')'.")
+ .addError(1, "Unrecoverable syntax error. (100% scanned).")
.test("if (product < ) {}", {es3: true});
test.done();
@@ -345,7 +347,9 @@ exports.regexp = function (test) {
.addError(17, "Invalid regular expression.")
.addError(20, "Invalid regular expression.")
.addError(21, "Invalid regular expression.")
- .addError(24, "Unclosed regular expression.");
+ .addError(24, "Unclosed regular expression.")
+ .addError(24, "Unrecoverable syntax error. (88% scanned).");
+
run.test(code, {es3: true});
run.test(code, {}); // es5
run.test(code, {esnext: true});
@@ -670,6 +674,7 @@ exports.testHtml = function (test) {
.addError(1, "Expected an assignment or function call and instead saw an expression.")
.addError(1, "Missing semicolon.")
.addError(1, "Expected an identifier and instead saw '<'.")
+ .addError(1, "Unrecoverable syntax error. (100% scanned).")
.test(html, {});
test.done();
};
@@ -4181,7 +4186,10 @@ exports["test destructuring function parameters as es5"] = function (test) {
.addError(30, "'destructuring expression' is available in ES6 (use esnext option) or Mozilla JS extensions (use moz).")
.addError(30, "'destructuring expression' is available in ES6 (use esnext option) or Mozilla JS extensions (use moz).")
.addError(30, "'arrow function syntax (=>)' is available in ES6 (use esnext option) or Mozilla JS extensions (use moz).")
- .test(src, {unused: true, undef: true});
+ .addError(31, "'destructuring expression' is available in ES6 (use esnext option) or Mozilla JS extensions (use moz).")
+ .addError(31, "'destructuring expression' is available in ES6 (use esnext option) or Mozilla JS extensions (use moz).")
+ .addError(31, "'arrow function syntax (=>)' is available in ES6 (use esnext option) or Mozilla JS extensions (use moz).")
+ .test(src, {unused: true, undef: true, maxerr: 100});
test.done();
};
@@ -4239,7 +4247,10 @@ exports["test destructuring function parameters as legacy JS"] = function (test)
.addError(30, "'destructuring expression' is available in ES6 (use esnext option) or Mozilla JS extensions (use moz).")
.addError(30, "'destructuring expression' is available in ES6 (use esnext option) or Mozilla JS extensions (use moz).")
.addError(30, "'arrow function syntax (=>)' is available in ES6 (use esnext option) or Mozilla JS extensions (use moz).")
- .test(src, {es3: true, unused: true, undef: true});
+ .addError(31, "'destructuring expression' is available in ES6 (use esnext option) or Mozilla JS extensions (use moz).")
+ .addError(31, "'destructuring expression' is available in ES6 (use esnext option) or Mozilla JS extensions (use moz).")
+ .addError(31, "'arrow function syntax (=>)' is available in ES6 (use esnext option) or Mozilla JS extensions (use moz).")
+ .test(src, {es3: true, unused: true, undef: true, maxerr: 100});
test.done();
};

0 comments on commit fde6c19

Please sign in to comment.