Remove "NotEarlyError" object

Because expectations regarding error "phase" are now expressed via test
meta-data, the test runner may now enforce this requirement on negative
tests.

Remove the "NotEarlyError" from the project source. This reduces the
amount of domain knowledge required to author tests and lessens the
potential for inconsistencies between tests.
This commit is contained in:
Mike Pennisi 2016-03-13 13:21:02 -04:00
parent 0d4a07ba8c
commit ade6d2e384
27 changed files with 2 additions and 42 deletions

View File

@ -157,12 +157,6 @@ assert.sameValue(actual, expected, message) | throw a new Test262Error instance
assert.notSameValue(actual, unexpected, message) | throw a new Test262Error instance if the first two arguments are [the same value](http://www.ecma-international.org/ecma-262/6.0/#sec-samevalue); accepts an optional string message for use in creating the error assert.notSameValue(actual, unexpected, message) | throw a new Test262Error instance if the first two arguments are [the same value](http://www.ecma-international.org/ecma-262/6.0/#sec-samevalue); accepts an optional string message for use in creating the error
assert.throws(expectedErrorConstructor, fn) | throw a new Test262Error instance if the provided function does not throw an error, or if the constructor of the value thrown does not match the provided constructor assert.throws(expectedErrorConstructor, fn) | throw a new Test262Error instance if the provided function does not throw an error, or if the constructor of the value thrown does not match the provided constructor
The test harness also defines the following objects:
Identifier | Purpose
-----------|--------
NotEarlyError | preconstructed error object used for testing syntax and other early errors; see Syntax Error & Early Error, below
``` ```
/// error class /// error class
function Test262Error(message) { function Test262Error(message) {
@ -178,8 +172,6 @@ function $ERROR(message) {
function $DONE(arg) { function $DONE(arg) {
//[omitted body] //[omitted body]
} }
var NotEarlyError = new Error(...);
``` ```
## Handling Errors and Negative Test Cases ## Handling Errors and Negative Test Cases
@ -193,9 +185,6 @@ negative:
type: SyntaxError type: SyntaxError
---*/ ---*/
// This `throw` statement guarantees that no code is executed in order to
// trigger the SyntaxError.
throw NotEarlyError;
var var = var; var var = var;
``` ```

View File

@ -1,10 +1,6 @@
/// Copyright (c) 2012 Ecma International. All rights reserved. /// Copyright (c) 2012 Ecma International. All rights reserved.
/// This code is governed by the BSD license found in the LICENSE file. /// This code is governed by the BSD license found in the LICENSE file.
var NotEarlyErrorString = "NotEarlyError";
var EarlyErrorRePat = "^((?!" + NotEarlyErrorString + ").)*$";
var NotEarlyError = new Error(NotEarlyErrorString);
function Test262Error(message) { function Test262Error(message) {
this.message = message || ""; this.message = message || "";
} }

View File

@ -10,7 +10,6 @@ negative:
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
throw NotEarlyError;
function f_10_5_1_gs(){ function f_10_5_1_gs(){
arguments = 7; arguments = 7;

View File

@ -14,5 +14,4 @@ flags: [raw]
"use strict"; "use strict";
"use strict"; "use strict";
throw NotEarlyError;
var public = 1; var public = 1;

View File

@ -13,5 +13,4 @@ flags: [onlyStrict]
---*/ ---*/
var _11_4_1_5 = 7; var _11_4_1_5 = 7;
throw NotEarlyError;
delete _11_4_1_5; delete _11_4_1_5;

View File

@ -13,5 +13,4 @@ negative:
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
throw NotEarlyError;
var obj = { set _11_1_5_1_fun(eval) {}}; var obj = { set _11_1_5_1_fun(eval) {}};

View File

@ -12,5 +12,4 @@ negative:
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
throw NotEarlyError;
arguments++; arguments++;

View File

@ -12,5 +12,4 @@ negative:
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
throw NotEarlyError;
--arguments; --arguments;

View File

@ -8,6 +8,5 @@ flags: [onlyStrict]
---*/ ---*/
"use strict"; "use strict";
if (this===undefined) {
throw NotEarlyError; assert.notSameValue(this, undefined);
}

View File

@ -10,5 +10,4 @@ negative:
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
throw NotEarlyError;
var y = 010; var y = 010;

View File

@ -12,7 +12,6 @@ negative:
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
throw NotEarlyError;
var a; var a;
a = 0x1; a = 0x1;
a = 01; a = 01;

View File

@ -9,5 +9,4 @@ negative:
type: SyntaxError type: SyntaxError
---*/ ---*/
throw NotEarlyError;
var re = //; var re = //;

View File

@ -12,5 +12,4 @@ negative:
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
throw NotEarlyError;
var _7_8_4_2 = '100abc\0110def'; var _7_8_4_2 = '100abc\0110def';

View File

@ -12,5 +12,4 @@ negative:
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
throw NotEarlyError;
var implements = 1; var implements = 1;

View File

@ -12,7 +12,6 @@ negative:
phase: early phase: early
type: SyntaxError type: SyntaxError
---*/ ---*/
throw NotEarlyError;
const const
let = "irrelevant initializer"; let = "irrelevant initializer";

View File

@ -12,5 +12,4 @@ negative:
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
throw NotEarlyError;
function _13_0_4_5_fun() { eval = 42; }; function _13_0_4_5_fun() { eval = 42; };

View File

@ -12,5 +12,4 @@ negative:
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
throw NotEarlyError;
function arguments() { }; function arguments() { };

View File

@ -13,5 +13,4 @@ negative:
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
throw NotEarlyError;
function _13_1_1_fun(eval) { } function _13_1_1_fun(eval) { }

View File

@ -13,5 +13,4 @@ negative:
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
throw NotEarlyError;
var _13_1_4_fun = function (arguments) { }; var _13_1_4_fun = function (arguments) { };

View File

@ -12,5 +12,4 @@ negative:
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
throw NotEarlyError;
function _13_1_5_fun(param, param) { } function _13_1_5_fun(param, param) { }

View File

@ -12,5 +12,4 @@ negative:
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
throw NotEarlyError;
var _13_1_8_fun = function (param, param) { }; var _13_1_8_fun = function (param, param) { };

View File

@ -26,7 +26,6 @@ negative:
phase: early phase: early
type: SyntaxError type: SyntaxError
---*/ ---*/
throw NotEarlyError;
let // start of a LexicalDeclaration, *not* an ASI opportunity let // start of a LexicalDeclaration, *not* an ASI opportunity
let; let;

View File

@ -26,7 +26,6 @@ negative:
phase: early phase: early
type: SyntaxError type: SyntaxError
---*/ ---*/
throw NotEarlyError;
let // start of a LexicalDeclaration, *not* an ASI opportunity let // start of a LexicalDeclaration, *not* an ASI opportunity
let = "irrelevant initializer"; let = "irrelevant initializer";

View File

@ -13,5 +13,4 @@ negative:
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
throw NotEarlyError;
try { } catch (eval) { } try { } catch (eval) { }

View File

@ -12,5 +12,4 @@ negative:
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
throw NotEarlyError;
for (var eval in arrObj) { } for (var eval in arrObj) { }

View File

@ -12,5 +12,4 @@ negative:
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
throw NotEarlyError;
var arguments; var arguments;

View File

@ -10,5 +10,4 @@ negative:
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
throw NotEarlyError;
with ({}) { } with ({}) { }