Refactor DeleteExpression tests for parsers

A number of tests for the parsing of the DeleteExpression production
were expressed using `eval`. This made the tests more complex than
necessary, and also prevented the tests from providing value to
ECMAScript parsers.

Remove the use of `eval` in the relevant tests and instead express the
expectations with literal source text. Remove superfluous tests which
only differed in the runtime semantics of source text that could not be
evaluated due to syntax errors.
This commit is contained in:
Mike Pennisi 2018-01-15 16:19:50 -05:00 committed by Rick Waldron
parent cc94370eb9
commit cae69a9775
29 changed files with 39 additions and 443 deletions

View File

@ -1,15 +0,0 @@
// Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 11.4.1-3-a-1-s
description: >
Strict Mode - SyntaxError is thrown when deleting an un-resolvable
reference
flags: [onlyStrict]
---*/
assert.throws(SyntaxError, function() {
eval("delete obj");
});

View File

@ -1,15 +0,0 @@
// Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 11.4.1-5-a-1-s
description: >
Strict Mode - SyntaxError is thrown when deleting a variable which
is a primitive value type (number)
flags: [onlyStrict]
---*/
var _11_4_1_5 = 5;
assert.throws(SyntaxError, function() {
eval("delete _11_4_1_5;");
});

View File

@ -1,15 +0,0 @@
// Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 11.4.1-5-a-10-s
description: >
Strict Mode - SyntaxError is thrown when deleting a variable of
type Array
flags: [onlyStrict]
---*/
var arrObj = [1,2,3];
assert.throws(SyntaxError, function() {
eval("delete arrObj;");
});

View File

@ -1,15 +0,0 @@
// Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 11.4.1-5-a-11-s
description: >
Strict Mode - SyntaxError is thrown when deleting a variable of
type String
flags: [onlyStrict]
---*/
var strObj = new String("abc");
assert.throws(SyntaxError, function() {
eval("delete strObj;");
});

View File

@ -1,15 +0,0 @@
// Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 11.4.1-5-a-12-s
description: >
Strict Mode - SyntaxError is thrown when deleting a variable of
type Boolean
flags: [onlyStrict]
---*/
var boolObj = new Boolean(false);
assert.throws(SyntaxError, function() {
eval("delete boolObj;");
});

View File

@ -1,15 +0,0 @@
// Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 11.4.1-5-a-13-s
description: >
Strict Mode - SyntaxError is thrown when deleting a variable of
type Number
flags: [onlyStrict]
---*/
var numObj = new Number(0);
assert.throws(SyntaxError, function() {
eval("delete numObj;");
});

View File

@ -1,15 +0,0 @@
// Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 11.4.1-5-a-14-s
description: >
Strict Mode - SyntaxError is thrown when deleting a variable of
type Date
flags: [onlyStrict]
---*/
var dateObj = new Date();
assert.throws(SyntaxError, function() {
eval("delete dateObj;");
});

View File

@ -1,15 +0,0 @@
// Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 11.4.1-5-a-15-s
description: >
Strict Mode - SyntaxError is thrown when deleting a variable of
type RegExp
flags: [onlyStrict]
---*/
var regObj = new RegExp();
assert.throws(SyntaxError, function() {
eval("delete regObj;");
});

View File

@ -1,15 +0,0 @@
// Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 11.4.1-5-a-16-s
description: >
Strict Mode - SyntaxError is thrown when deleting a variable of
type Error
flags: [onlyStrict]
---*/
var errObj = new Error();
assert.throws(SyntaxError, function() {
eval("delete errObj;");
});

View File

@ -1,15 +0,0 @@
// Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 11.4.1-5-a-17-s
description: >
Strict Mode - SyntaxError is thrown when deleting a variable of
type Arguments
flags: [onlyStrict]
---*/
assert.throws(SyntaxError, function() {
eval("var argObj = (function (a, b) { delete arguments; }(1, 2));");
});

View File

@ -1,15 +0,0 @@
// Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 11.4.1-5-a-18-s
description: >
Strict Mode - SyntaxError is thrown when deleting a built-in
(Object)
flags: [onlyStrict]
---*/
assert.throws(SyntaxError, function() {
eval("delete Object;");
});

View File

@ -1,15 +0,0 @@
// Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 11.4.1-5-a-19-s
description: >
Strict Mode - SyntaxError is thrown when deleting a built-in
(Function)
flags: [onlyStrict]
---*/
assert.throws(SyntaxError, function() {
eval("delete Function;");
});

View File

@ -1,17 +0,0 @@
// Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 11.4.1-5-a-2-s
description: >
Strict Mode - SyntaxError is thrown when deleting a function
parameter
flags: [onlyStrict]
---*/
function funObj(x) {
eval("delete x;");
}
assert.throws(SyntaxError, function() {
funObj(1);
});

View File

@ -1,15 +0,0 @@
// Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 11.4.1-5-a-20-s
description: >
Strict Mode - SyntaxError is thrown when deleting a built-in
(Array)
flags: [onlyStrict]
---*/
assert.throws(SyntaxError, function() {
eval("delete Array;");
});

View File

@ -1,15 +0,0 @@
// Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 11.4.1-5-a-21-s
description: >
Strict Mode - SyntaxError is thrown when deleting a built-in
(String)
flags: [onlyStrict]
---*/
assert.throws(SyntaxError, function() {
eval("delete String;");
});

View File

@ -1,15 +0,0 @@
// Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 11.4.1-5-a-22-s
description: >
Strict Mode - SyntaxError is thrown when deleting a built-in
(Boolean)
flags: [onlyStrict]
---*/
assert.throws(SyntaxError, function() {
eval("delete Boolean;");
});

View File

@ -1,15 +0,0 @@
// Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 11.4.1-5-a-23-s
description: >
Strict Mode - SyntaxError is thrown when deleting a built-in
(Number)
flags: [onlyStrict]
---*/
assert.throws(SyntaxError, function() {
eval("delete Number;");
});

View File

@ -1,13 +0,0 @@
// Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 11.4.1-5-a-24-s
description: Strict Mode - SyntaxError is thrown when deleting a built-in (Date)
flags: [onlyStrict]
---*/
assert.throws(SyntaxError, function() {
eval("delete Date;");
});

View File

@ -1,15 +0,0 @@
// Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 11.4.1-5-a-25-s
description: >
Strict Mode - SyntaxError is thrown when deleting a built-in
(RegExp)
flags: [onlyStrict]
---*/
assert.throws(SyntaxError, function() {
eval("delete RegExp;");
});

View File

@ -1,14 +0,0 @@
// Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 11.4.1-5-a-26-s
description: >
Strict Mode - SyntaxError is thrown when deleting a built-in
(Error)
flags: [onlyStrict]
---*/
assert.throws(SyntaxError, function() {
eval("delete Error;");
});

View File

@ -1,13 +0,0 @@
// Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 11.4.1-5-a-3-s
description: Strict Mode - SyntaxError is thrown when deleting a function name
flags: [onlyStrict]
---*/
function funObj () { }
assert.throws(SyntaxError, function() {
eval("delete funObj");
});

View File

@ -1,17 +0,0 @@
// Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 11.4.1-5-a-4-s
description: >
Strict Mode - SyntaxError is thrown when deleting a function
parameter
flags: [onlyStrict]
---*/
function funObj(x, y, z) {
eval("delete y;");
}
assert.throws(SyntaxError, function() {
funObj(1);
});

View File

@ -1,15 +0,0 @@
// Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 11.4.1-5-a-5-s
description: >
Strict Mode - SyntaxError is thrown when deleting a variable which
is a primitive type (boolean)
flags: [onlyStrict]
---*/
var _11_4_1_5 = true;
assert.throws(SyntaxError, function() {
eval("delete _11_4_1_5;");
});

View File

@ -1,15 +0,0 @@
// Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 11.4.1-5-a-6-s
description: >
Strict Mode - SyntaxError is thrown when deleting a variable which
is a primitive type (string)
flags: [onlyStrict]
---*/
var _11_4_1_5 = "abc";
assert.throws(SyntaxError, function() {
eval("delete _11_4_1_5;");
});

View File

@ -1,15 +0,0 @@
// Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 11.4.1-5-a-7-s
description: >
Strict Mode - SyntaxError is thrown when deleting a variable of
type Object
flags: [onlyStrict]
---*/
var obj = new Object();
assert.throws(SyntaxError, function() {
eval("delete obj;");
});

View File

@ -1,13 +0,0 @@
// Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 11.4.1-5-a-8-s
description: Strict Mode - SyntaxError is thrown when deleting a function object
flags: [onlyStrict]
---*/
var funObj = function () { };
assert.throws(SyntaxError, function() {
eval("delete funObj;");
});

View File

@ -1,15 +0,0 @@
// Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 11.4.1-5-a-9-s
description: >
Strict Mode - SyntaxError is thrown when deleting a variable of
type function (declaration)
flags: [onlyStrict]
---*/
function funObj () { };
assert.throws(SyntaxError, function() {
eval("delete funObj;");
});

View File

@ -1,6 +1,5 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: |
White Space and Line Terminator between "delete" and UnaryExpression are
@ -9,52 +8,36 @@ es5id: 11.4.1_A1
description: Checking by using eval
---*/
//CHECK#1
if (eval("delete\u00090") !== true) {
$ERROR('#1: delete\\u00090 === true');
}
var result;
//CHECK#2
if (eval("delete\u000B0") !== true) {
$ERROR('#2: delete\\u000B0 === true');
}
result = delete 0;
assert.sameValue(result, true, '\\u0009');
//CHECK#3
if (eval("delete\u000C0") !== true) {
$ERROR('#3: delete\\u000C0 === true');
}
result = delete 0;
assert.sameValue(result, true, '\\u000B');
//CHECK#4
if (eval("delete\u00200") !== true) {
$ERROR('#4: delete\\u00200 === true');
}
result = delete 0;
assert.sameValue(result, true, '\\u000C');
//CHECK#5
if (eval("delete\u00A00") !== true) {
$ERROR('#5: delete\\u00A00 === true');
}
result = delete 0;
assert.sameValue(result, true, '\\u0020');
//CHECK#6
if (eval("delete\u000A0") !== true) {
$ERROR('#6: delete\\u000A0 === true');
}
result = delete 0;
assert.sameValue(result, true, '\\u00A0');
//CHECK#7
if (eval("delete\u000D0") !== true) {
$ERROR('#7: delete\\u000D0 === true');
}
result = delete
0;
assert.sameValue(result, true, '\\u000A');
//CHECK#8
if (eval("delete\u20280") !== true) {
$ERROR('#8: delete\\u20280 === true');
}
result = delete 0;
assert.sameValue(result, true, '\\u000D');
//CHECK#9
if (eval("delete\u20290") !== true) {
$ERROR('#9: delete\\u20290 === true');
}
result = delete0;
assert.sameValue(result, true, '\\u2028');
//CHECK#10
if (eval("delete\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20290") !== true) {
$ERROR('#10: delete\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20290 === true');
}
result = delete0;
assert.sameValue(result, true, '\\u2029');
result = delete  
0;
assert.sameValue(result, true, '\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029');

View File

@ -0,0 +1,15 @@
// Copyright (c) 2018 Mike Pennisi. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-delete-operator-static-semantics-early-errors
description: Parsing error when operand is an IdentifierReference
info: |
It is a Syntax Error if the UnaryExpression is contained in strict mode code
and the derived UnaryExpression is PrimaryExpression:IdentifierReference.
negative:
phase: parse
type: SyntaxError
flags: [onlyStrict]
---*/
delete test262identifier;