mirror of https://github.com/tc39/test262.git
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:
parent
0d4a07ba8c
commit
ade6d2e384
|
@ -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.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
|
||||
function Test262Error(message) {
|
||||
|
@ -178,8 +172,6 @@ function $ERROR(message) {
|
|||
function $DONE(arg) {
|
||||
//[omitted body]
|
||||
}
|
||||
|
||||
var NotEarlyError = new Error(...);
|
||||
```
|
||||
|
||||
## Handling Errors and Negative Test Cases
|
||||
|
@ -193,9 +185,6 @@ negative:
|
|||
type: SyntaxError
|
||||
---*/
|
||||
|
||||
// This `throw` statement guarantees that no code is executed in order to
|
||||
// trigger the SyntaxError.
|
||||
throw NotEarlyError;
|
||||
var var = var;
|
||||
```
|
||||
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
/// Copyright (c) 2012 Ecma International. All rights reserved.
|
||||
/// 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) {
|
||||
this.message = message || "";
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ negative:
|
|||
flags: [onlyStrict]
|
||||
---*/
|
||||
|
||||
throw NotEarlyError;
|
||||
|
||||
function f_10_5_1_gs(){
|
||||
arguments = 7;
|
||||
|
|
|
@ -14,5 +14,4 @@ flags: [raw]
|
|||
|
||||
"use strict";
|
||||
"use strict";
|
||||
throw NotEarlyError;
|
||||
var public = 1;
|
||||
|
|
|
@ -13,5 +13,4 @@ flags: [onlyStrict]
|
|||
---*/
|
||||
|
||||
var _11_4_1_5 = 7;
|
||||
throw NotEarlyError;
|
||||
delete _11_4_1_5;
|
||||
|
|
|
@ -13,5 +13,4 @@ negative:
|
|||
flags: [onlyStrict]
|
||||
---*/
|
||||
|
||||
throw NotEarlyError;
|
||||
var obj = { set _11_1_5_1_fun(eval) {}};
|
||||
|
|
|
@ -12,5 +12,4 @@ negative:
|
|||
flags: [onlyStrict]
|
||||
---*/
|
||||
|
||||
throw NotEarlyError;
|
||||
arguments++;
|
||||
|
|
|
@ -12,5 +12,4 @@ negative:
|
|||
flags: [onlyStrict]
|
||||
---*/
|
||||
|
||||
throw NotEarlyError;
|
||||
--arguments;
|
||||
|
|
|
@ -8,6 +8,5 @@ flags: [onlyStrict]
|
|||
---*/
|
||||
|
||||
"use strict";
|
||||
if (this===undefined) {
|
||||
throw NotEarlyError;
|
||||
}
|
||||
|
||||
assert.notSameValue(this, undefined);
|
||||
|
|
|
@ -10,5 +10,4 @@ negative:
|
|||
flags: [onlyStrict]
|
||||
---*/
|
||||
|
||||
throw NotEarlyError;
|
||||
var y = 010;
|
||||
|
|
|
@ -12,7 +12,6 @@ negative:
|
|||
flags: [onlyStrict]
|
||||
---*/
|
||||
|
||||
throw NotEarlyError;
|
||||
var a;
|
||||
a = 0x1;
|
||||
a = 01;
|
||||
|
|
|
@ -9,5 +9,4 @@ negative:
|
|||
type: SyntaxError
|
||||
---*/
|
||||
|
||||
throw NotEarlyError;
|
||||
var re = //;
|
||||
|
|
|
@ -12,5 +12,4 @@ negative:
|
|||
flags: [onlyStrict]
|
||||
---*/
|
||||
|
||||
throw NotEarlyError;
|
||||
var _7_8_4_2 = '100abc\0110def';
|
||||
|
|
|
@ -12,5 +12,4 @@ negative:
|
|||
flags: [onlyStrict]
|
||||
---*/
|
||||
|
||||
throw NotEarlyError;
|
||||
var implements = 1;
|
||||
|
|
|
@ -12,7 +12,6 @@ negative:
|
|||
phase: early
|
||||
type: SyntaxError
|
||||
---*/
|
||||
throw NotEarlyError;
|
||||
|
||||
const
|
||||
let = "irrelevant initializer";
|
||||
|
|
|
@ -12,5 +12,4 @@ negative:
|
|||
flags: [onlyStrict]
|
||||
---*/
|
||||
|
||||
throw NotEarlyError;
|
||||
function _13_0_4_5_fun() { eval = 42; };
|
||||
|
|
|
@ -12,5 +12,4 @@ negative:
|
|||
flags: [onlyStrict]
|
||||
---*/
|
||||
|
||||
throw NotEarlyError;
|
||||
function arguments() { };
|
||||
|
|
|
@ -13,5 +13,4 @@ negative:
|
|||
flags: [onlyStrict]
|
||||
---*/
|
||||
|
||||
throw NotEarlyError;
|
||||
function _13_1_1_fun(eval) { }
|
||||
|
|
|
@ -13,5 +13,4 @@ negative:
|
|||
flags: [onlyStrict]
|
||||
---*/
|
||||
|
||||
throw NotEarlyError;
|
||||
var _13_1_4_fun = function (arguments) { };
|
||||
|
|
|
@ -12,5 +12,4 @@ negative:
|
|||
flags: [onlyStrict]
|
||||
---*/
|
||||
|
||||
throw NotEarlyError;
|
||||
function _13_1_5_fun(param, param) { }
|
||||
|
|
|
@ -12,5 +12,4 @@ negative:
|
|||
flags: [onlyStrict]
|
||||
---*/
|
||||
|
||||
throw NotEarlyError;
|
||||
var _13_1_8_fun = function (param, param) { };
|
||||
|
|
|
@ -26,7 +26,6 @@ negative:
|
|||
phase: early
|
||||
type: SyntaxError
|
||||
---*/
|
||||
throw NotEarlyError;
|
||||
|
||||
let // start of a LexicalDeclaration, *not* an ASI opportunity
|
||||
let;
|
||||
|
|
|
@ -26,7 +26,6 @@ negative:
|
|||
phase: early
|
||||
type: SyntaxError
|
||||
---*/
|
||||
throw NotEarlyError;
|
||||
|
||||
let // start of a LexicalDeclaration, *not* an ASI opportunity
|
||||
let = "irrelevant initializer";
|
||||
|
|
|
@ -13,5 +13,4 @@ negative:
|
|||
flags: [onlyStrict]
|
||||
---*/
|
||||
|
||||
throw NotEarlyError;
|
||||
try { } catch (eval) { }
|
||||
|
|
|
@ -12,5 +12,4 @@ negative:
|
|||
flags: [onlyStrict]
|
||||
---*/
|
||||
|
||||
throw NotEarlyError;
|
||||
for (var eval in arrObj) { }
|
||||
|
|
|
@ -12,5 +12,4 @@ negative:
|
|||
flags: [onlyStrict]
|
||||
---*/
|
||||
|
||||
throw NotEarlyError;
|
||||
var arguments;
|
||||
|
|
|
@ -10,5 +10,4 @@ negative:
|
|||
flags: [onlyStrict]
|
||||
---*/
|
||||
|
||||
throw NotEarlyError;
|
||||
with ({}) { }
|
||||
|
|
Loading…
Reference in New Issue