Miscellaneous: cleanup very old delete operator tests.

This commit is contained in:
Rick Waldron 2020-09-11 11:58:45 -04:00
parent 3b1f4f7e1b
commit f99bec89b7
56 changed files with 356 additions and 297 deletions

View File

@ -5,17 +5,14 @@
info: | info: |
This test is actually testing the [[Delete]] internal method (8.12.8). Since the This test is actually testing the [[Delete]] internal method (8.12.8). Since the
language provides no way to directly exercise [[Delete]], the tests are placed here. language provides no way to directly exercise [[Delete]], the tests are placed here.
es5id: 11.4.1-0-1 esid: sec-delete-operator-runtime-semantics-evaluation
description: delete operator as UnaryExpression description: delete operator as UnaryExpression
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function testcase() { var x = 1;
var x = 1; var y = 2;
var y = 2; var z = 3;
var z = 3;
assert((!delete x || delete y), '(!delete x || delete y)'); assert((!delete x || delete y), '(!delete x || delete y)');
assert(delete delete z, 'delete delete z'); assert(delete delete z, 'delete delete z');
}
testcase();

View File

@ -2,16 +2,18 @@
// 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.
/*--- /*---
es5id: 11.4.1-2-2 esid: sec-delete-operator-runtime-semantics-evaluation
description: > description: >
delete operator returns true when deleting returned value from a delete operator returns true when deleting returned value from a
function function
---*/ ---*/
var bIsFooCalled = false; var bIsFooCalled = false;
var foo = function(){bIsFooCalled = true;}; var foo = function() {
bIsFooCalled = true;
};
var d = delete foo(); var d = delete foo();
assert.sameValue(d, true, 'd'); assert.sameValue(d, true, 'd');
assert.sameValue(bIsFooCalled, true, 'bIsFooCalled'); assert.sameValue(bIsFooCalled, true, 'bIsFooCalled');

View File

@ -2,14 +2,11 @@
// 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.
/*--- /*---
es5id: 11.4.1-3-1 esid: sec-delete-operator-runtime-semantics-evaluation
description: > description: >
delete operator returns true when deleting an unresolvable delete operator returns true when deleting an unresolvable
reference reference
flags: [noStrict] flags: [noStrict]
---*/ ---*/
// just cooking up a long/veryLikely unique name assert.sameValue(delete unresolvable, true, 'delete unresolvable === true');
var d = delete __ES3_1_test_suite_test_11_4_1_3_unique_id_0__;
assert.sameValue(d, true, 'd');

View File

@ -2,13 +2,12 @@
// 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.
/*--- /*---
es5id: 11.4.1-3-2 esid: sec-delete-operator-runtime-semantics-evaluation
description: > description: >
delete operator throws ReferenceError when deleting an explicitly delete operator throws ReferenceError when deleting an explicitly
qualified yet unresolvable reference (base obj undefined) qualified yet unresolvable reference (base obj undefined)
---*/ ---*/
// just cooking up a long/veryLikely unique name
assert.throws(ReferenceError, function() { assert.throws(ReferenceError, function() {
var d = delete __ES3_1_test_suite_test_11_4_1_3_unique_id_2__.x; delete unresolvable.x;
}); });

View File

@ -2,13 +2,11 @@
// 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.
/*--- /*---
es5id: 11.4.1-3-3 esid: sec-delete-operator-runtime-semantics-evaluation
description: > description: >
delete operator returns true when deleting an explicitly qualified delete operator returns true when deleting an explicitly qualified
yet unresolvable reference (property undefined for base obj) yet unresolvable reference (property undefined for base obj)
---*/ ---*/
var __ES3_1_test_suite_test_11_4_1_3_unique_id_3__ = {}; var o = {};
var d = delete __ES3_1_test_suite_test_11_4_1_3_unique_id_3__.x; assert.sameValue(delete o.x, true);
assert.sameValue(d, true, 'd');

View File

@ -2,19 +2,19 @@
// 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.
/*--- /*---
es5id: 11.4.1-4-a-1-s esid: sec-delete-operator-runtime-semantics-evaluation
description: > description: >
Strict Mode - TypeError is thrown when deleting non-configurable Strict Mode - TypeError is thrown when deleting non-configurable
data property data property
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
var obj = {}; var obj = {};
Object.defineProperty(obj, "prop", { Object.defineProperty(obj, 'prop', {
value: "abc", value: 'abc',
configurable: false configurable: false,
});
assert.throws(TypeError, function() {
delete obj.prop;
}); });
assert.sameValue(obj.prop, "abc", 'obj.prop'); assert.throws(TypeError, function() {
delete obj.prop;
});
assert.sameValue(obj.prop, 'abc', 'obj.prop');

View File

@ -2,21 +2,21 @@
// 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.
/*--- /*---
es5id: 11.4.1-4-a-2-s esid: sec-delete-operator-runtime-semantics-evaluation
description: > description: >
Strict Mode - TypeError is thrown when deleting non-configurable Strict Mode - TypeError is thrown when deleting non-configurable
accessor property accessor property
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
var obj = {}; var obj = {};
Object.defineProperty(obj, "prop", { Object.defineProperty(obj, 'prop', {
get: function () { get: function() {
return "abc"; return 'abc';
}, },
configurable: false configurable: false,
});
assert.throws(TypeError, function() {
delete obj.prop;
}); });
assert.sameValue(obj.prop, "abc", 'obj.prop'); assert.throws(TypeError, function() {
delete obj.prop;
});
assert.sameValue(obj.prop, 'abc', 'obj.prop');

View File

@ -2,17 +2,21 @@
// 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.
/*--- /*---
es5id: 11.4.1-4-a-3-s esid: sec-delete-operator-runtime-semantics-evaluation
description: > description: >
TypeError isn't thrown when deleting configurable data property TypeError isn't thrown when deleting configurable data property
---*/ ---*/
var obj = {}; var obj = {};
Object.defineProperty(obj, "prop", { Object.defineProperty(obj, 'prop', {
value: "abc", value: 'abc',
configurable: true configurable: true,
}); });
delete obj.prop; delete obj.prop;
assert.sameValue(obj.hasOwnProperty("prop"), false, 'obj.hasOwnProperty("prop")'); assert.sameValue(
obj.hasOwnProperty('prop'),
false,
'obj.hasOwnProperty("prop")'
);

View File

@ -2,19 +2,23 @@
// 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.
/*--- /*---
es5id: 11.4.1-4-a-4-s esid: sec-delete-operator-runtime-semantics-evaluation
description: > description: >
TypeError isn't thrown when deleting configurable accessor property TypeError isn't thrown when deleting configurable accessor property
---*/ ---*/
var obj = {}; var obj = {};
Object.defineProperty(obj, "prop", { Object.defineProperty(obj, 'prop', {
get: function () { get: function() {
return "abc"; return 'abc';
}, },
configurable: true configurable: true,
}); });
delete obj.prop; delete obj.prop;
assert.sameValue(obj.hasOwnProperty("prop"), false, 'obj.hasOwnProperty("prop")'); assert.sameValue(
obj.hasOwnProperty('prop'),
false,
'obj.hasOwnProperty("prop")'
);

View File

@ -5,18 +5,21 @@
info: | info: |
This test is actually testing the [[Delete]] internal method (8.12.8). Since the This test is actually testing the [[Delete]] internal method (8.12.8). Since the
language provides no way to directly exercise [[Delete]], the tests are placed here. language provides no way to directly exercise [[Delete]], the tests are placed here.
es5id: 11.4.1-4.a-1 esid: sec-delete-operator-runtime-semantics-evaluation
description: > description: >
delete operator returns true when deleting a configurable data delete operator returns true when deleting a configurable data
property property
---*/ ---*/
var o = {}; var o = {};
var desc = { value: 1, configurable: true }; var desc = {
Object.defineProperty(o, "foo", desc); value: 1,
configurable: true,
};
Object.defineProperty(o, 'foo', desc);
var d = delete o.foo; var d = delete o.foo;
assert.sameValue(d, true, 'd'); assert.sameValue(d, true, 'd');
assert.sameValue(o.hasOwnProperty("foo"), false, 'o.hasOwnProperty("foo")'); assert.sameValue(o.hasOwnProperty('foo'), false, 'o.hasOwnProperty("foo")');

View File

@ -5,7 +5,7 @@
info: | info: |
This test is actually testing the [[Delete]] internal method (8.12.8). Since the This test is actually testing the [[Delete]] internal method (8.12.8). Since the
language provides no way to directly exercise [[Delete]], the tests are placed here. language provides no way to directly exercise [[Delete]], the tests are placed here.
es5id: 11.4.1-4.a-10 esid: sec-delete-operator-runtime-semantics-evaluation
description: > description: >
delete operator returns true for property (stringify) defined on delete operator returns true for property (stringify) defined on
built-in object (JSON) built-in object (JSON)

View File

@ -5,21 +5,19 @@
info: | info: |
This test is actually testing the [[Delete]] internal method (8.12.8). Since the This test is actually testing the [[Delete]] internal method (8.12.8). Since the
language provides no way to directly exercise [[Delete]], the tests are placed here. language provides no way to directly exercise [[Delete]], the tests are placed here.
es5id: 11.4.1-4.a-11 esid: sec-delete-operator-runtime-semantics-evaluation
description: > description: >
delete operator returns true on deleting arguments delete operator returns true on deleting arguments
properties(arguments.callee) properties(arguments.callee)
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function testcase() { (function() {
function foo(a,b) function foo(a, b) {
{ return delete arguments.callee;
return (delete arguments.callee);
} }
var d = delete arguments.callee; var d = delete arguments.callee;
assert.sameValue(d, true, 'd'); assert.sameValue(d, true, 'd');
assert.sameValue(arguments.callee, undefined, 'arguments.callee'); assert.sameValue(arguments.callee, undefined, 'arguments.callee');
} })();
testcase();

View File

@ -5,14 +5,14 @@
info: | info: |
This test is actually testing the [[Delete]] internal method (8.12.8). Since the This test is actually testing the [[Delete]] internal method (8.12.8). Since the
language provides no way to directly exercise [[Delete]], the tests are placed here. language provides no way to directly exercise [[Delete]], the tests are placed here.
es5id: 11.4.1-4.a-12 esid: sec-delete-operator-runtime-semantics-evaluation
description: delete operator returns false when deleting a property(length) description: delete operator returns false when deleting a property(length)
flags: [noStrict] flags: [noStrict]
---*/ ---*/
var a = [1,2,3] var a = [1, 2, 3];
a.x = 10; a.x = 10;
var d = delete a.length var d = delete a.length;
assert.sameValue(d, false, 'd'); assert.sameValue(d, false, 'd');
assert.sameValue(a.length, 3, 'a.length'); assert.sameValue(a.length, 3, 'a.length');

View File

@ -5,19 +5,15 @@
info: | info: |
This test is actually testing the [[Delete]] internal method (8.12.8). Since the This test is actually testing the [[Delete]] internal method (8.12.8). Since the
language provides no way to directly exercise [[Delete]], the tests are placed here. language provides no way to directly exercise [[Delete]], the tests are placed here.
es5id: 11.4.1-4.a-13 esid: sec-delete-operator-runtime-semantics-evaluation
description: delete operator returns false when deleting Array object description: delete operator returns false when deleting Array object
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function testcase() { var a = [1, 2, 3];
a.x = 10;
var a = [1,2,3] var d = delete a;
a.x = 10;
var d = delete a assert.sameValue(d, false, 'd');
assert.sameValue(Array.isArray(a), true, 'Array.isArray(a)');
assert.sameValue(d, false, 'd');
assert.sameValue(Array.isArray(a), true, 'Array.isArray(a)');
}
testcase();

View File

@ -5,13 +5,13 @@
info: | info: |
This test is actually testing the [[Delete]] internal method (8.12.8). Since the This test is actually testing the [[Delete]] internal method (8.12.8). Since the
language provides no way to directly exercise [[Delete]], the tests are placed here. language provides no way to directly exercise [[Delete]], the tests are placed here.
es5id: 11.4.1-4.a-14 esid: sec-delete-operator-runtime-semantics-evaluation
description: delete operator returns true when deleting Array elements description: delete operator returns true when deleting Array elements
---*/ ---*/
var a = [1,2,3] var a = [1, 2, 3];
a.x = 10; a.x = 10;
var d = delete a[1] var d = delete a[1];
assert.sameValue(d, true, 'd'); assert.sameValue(d, true, 'd');
assert.sameValue(a[1], undefined, 'a[1]'); assert.sameValue(a[1], undefined, 'a[1]');

View File

@ -5,13 +5,13 @@
info: | info: |
This test is actually testing the [[Delete]] internal method (8.12.8). Since the This test is actually testing the [[Delete]] internal method (8.12.8). Since the
language provides no way to directly exercise [[Delete]], the tests are placed here. language provides no way to directly exercise [[Delete]], the tests are placed here.
es5id: 11.4.1-4.a-15 esid: sec-delete-operator-runtime-semantics-evaluation
description: delete operator returns true when deleting Array expandos description: delete operator returns true when deleting Array expandos
---*/ ---*/
var a = [1,2,3] var a = [1, 2, 3];
a.x = 10; a.x = 10;
var d = delete a.x; var d = delete a.x;
assert.sameValue(d, true, 'd'); assert.sameValue(d, true, 'd');
assert.sameValue(a.x, undefined, 'a.x'); assert.sameValue(a.x, undefined, 'a.x');

View File

@ -5,13 +5,12 @@
info: | info: |
This test is actually testing the [[Delete]] internal method (8.12.8). Since the This test is actually testing the [[Delete]] internal method (8.12.8). Since the
language provides no way to directly exercise [[Delete]], the tests are placed here. language provides no way to directly exercise [[Delete]], the tests are placed here.
es5id: 11.4.1-4.a-16 esid: sec-delete-operator-runtime-semantics-evaluation
description: delete operator returns false on deleting arguments object description: delete operator returns false on deleting arguments object
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function testcase() { (function() {
assert.sameValue(delete arguments, false, 'delete arguments'); assert.sameValue(delete arguments, false, 'delete arguments');
assert.notSameValue(arguments, undefined, 'arguments'); assert.notSameValue(arguments, undefined, 'arguments');
} })();
testcase();

View File

@ -5,14 +5,13 @@
info: | info: |
This test is actually testing the [[Delete]] internal method (8.12.8). Since the This test is actually testing the [[Delete]] internal method (8.12.8). Since the
language provides no way to directly exercise [[Delete]], the tests are placed here. language provides no way to directly exercise [[Delete]], the tests are placed here.
es5id: 11.4.1-4.a-17 esid: sec-delete-operator-runtime-semantics-evaluation
description: delete operator returns true on deleting a arguments element description: delete operator returns true on deleting a arguments element
---*/ ---*/
function foo(a,b) function foo(a, b) {
{ var d = delete arguments[0];
var d = delete arguments[0]; return d === true && arguments[0] === undefined;
return (d === true && arguments[0] === undefined); }
}
assert.sameValue(foo(1,2), true, 'foo(1,2)'); assert.sameValue(foo(1, 2), true, 'foo(1,2)');

View File

@ -5,21 +5,26 @@
info: | info: |
This test is actually testing the [[Delete]] internal method (8.12.8). Since the This test is actually testing the [[Delete]] internal method (8.12.8). Since the
language provides no way to directly exercise [[Delete]], the tests are placed here. language provides no way to directly exercise [[Delete]], the tests are placed here.
es5id: 11.4.1-4.a-2 esid: sec-delete-operator-runtime-semantics-evaluation
description: > description: >
delete operator returns true when deleting a configurable accessor delete operator returns true when deleting a configurable accessor
property property
---*/ ---*/
var o = {}; var o = {};
// define an accessor // define an accessor
// dummy getter // dummy getter
var getter = function () { return 1; } var getter = function() {
var desc = { get: getter, configurable: true }; return 1;
Object.defineProperty(o, "foo", desc); };
var desc = {
var d = delete o.foo; get: getter,
configurable: true,
};
Object.defineProperty(o, 'foo', desc);
var d = delete o.foo;
assert.sameValue(d, true, 'd'); assert.sameValue(d, true, 'd');
assert.sameValue(o.hasOwnProperty("foo"), false, 'o.hasOwnProperty("foo")'); assert.sameValue(o.hasOwnProperty('foo'), false, 'o.hasOwnProperty("foo")');

View File

@ -5,18 +5,20 @@
info: | info: |
This test is actually testing the [[Delete]] internal method (8.12.8). Since the This test is actually testing the [[Delete]] internal method (8.12.8). Since the
language provides no way to directly exercise [[Delete]], the tests are placed here. language provides no way to directly exercise [[Delete]], the tests are placed here.
es5id: 11.4.1-4.a-3-s esid: sec-delete-operator-runtime-semantics-evaluation
description: > description: >
delete operator throws TypeError when deleting a non-configurable delete operator throws TypeError when deleting a non-configurable
data property in strict mode data property in strict mode
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
var o = {}; var o = {};
var desc = { value : 1 }; // all other attributes default to false var desc = {
Object.defineProperty(o, "foo", desc); value: 1,
}; // all other attributes default to false
// Now, deleting o.foo should throw TypeError because [[Configurable]] on foo is false. Object.defineProperty(o, 'foo', desc);
// Now, deleting o.foo should throw TypeError because [[Configurable]] on foo is false.
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
delete o.foo; delete o.foo;
}); });

View File

@ -5,19 +5,22 @@
info: | info: |
This test is actually testing the [[Delete]] internal method (8.12.8). Since the This test is actually testing the [[Delete]] internal method (8.12.8). Since the
language provides no way to directly exercise [[Delete]], the tests are placed here. language provides no way to directly exercise [[Delete]], the tests are placed here.
es5id: 11.4.1-4.a-3 esid: sec-delete-operator-runtime-semantics-evaluation
description: > description: >
delete operator returns false when deleting a non-configurable delete operator returns false when deleting a non-configurable
data property data property
flags: [noStrict] flags: [noStrict]
---*/ ---*/
var o = {}; var o = {};
var desc = { value : 1, configurable: false }; // all other attributes default to false var desc = {
Object.defineProperty(o, "foo", desc); value: 1,
configurable: false,
// Now, deleting o.foo should fail because [[Configurable]] on foo is false. }; // all other attributes default to false
var d = delete o.foo; Object.defineProperty(o, 'foo', desc);
// Now, deleting o.foo should fail because [[Configurable]] on foo is false.
var d = delete o.foo;
assert.sameValue(d, false, 'd'); assert.sameValue(d, false, 'd');
assert.sameValue(o.hasOwnProperty("foo"), true, 'o.hasOwnProperty("foo")'); assert.sameValue(o.hasOwnProperty('foo'), true, 'o.hasOwnProperty("foo")');

View File

@ -5,14 +5,14 @@
info: | info: |
This test is actually testing the [[Delete]] internal method (8.12.8). Since the This test is actually testing the [[Delete]] internal method (8.12.8). Since the
language provides no way to directly exercise [[Delete]], the tests are placed here. language provides no way to directly exercise [[Delete]], the tests are placed here.
es5id: 11.4.1-4.a-4 esid: sec-delete-operator-runtime-semantics-evaluation
description: > description: >
delete operator returns false when deleting a non-configurable delete operator returns false when deleting a non-configurable
data property (NaN) data property (NaN)
flags: [noStrict] flags: [noStrict]
---*/ ---*/
// NaN (15.1.1.1) has [[Configurable]] set to false. // NaN (15.1.1.1) has [[Configurable]] set to false.
var d = delete NaN; var d = delete NaN;
assert.sameValue(d, false, 'd'); assert.sameValue(d, false, 'd');

View File

@ -5,24 +5,20 @@
info: | info: |
This test is actually testing the [[Delete]] internal method (8.12.8). Since the This test is actually testing the [[Delete]] internal method (8.12.8). Since the
language provides no way to directly exercise [[Delete]], the tests are placed here. language provides no way to directly exercise [[Delete]], the tests are placed here.
es5id: 11.4.1-4.a-5 esid: sec-delete-operator-runtime-semantics-evaluation
description: > description: >
delete operator returns false when deleting the declaration of the environment object delete operator returns false when deleting the declaration of the environment object
inside 'with' inside 'with'
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function testcase() { var o = new Object();
var o = new Object(); o.x = 1;
o.x = 1; var d;
var d; with(o) {
with(o) d = delete o;
{ }
d = delete o;
}
assert.sameValue(d, false, 'd'); assert.sameValue(d, false, 'd');
assert.sameValue(typeof(o), 'object', 'typeof(o)'); assert.sameValue(typeof o, 'object', 'typeof(o)');
assert.sameValue(o.x, 1, 'o.x'); assert.sameValue(o.x, 1, 'o.x');
}
testcase();

View File

@ -5,18 +5,17 @@
info: | info: |
This test is actually testing the [[Delete]] internal method (8.12.8). Since the This test is actually testing the [[Delete]] internal method (8.12.8). Since the
language provides no way to directly exercise [[Delete]], the tests are placed here. language provides no way to directly exercise [[Delete]], the tests are placed here.
es5id: 11.4.1-4.a-6 esid: sec-delete-operator-runtime-semantics-evaluation
description: delete operator returns true when deleting a property inside 'with' description: delete operator returns true when deleting a property inside 'with'
flags: [noStrict] flags: [noStrict]
---*/ ---*/
var o = new Object(); var o = new Object();
o.x = 1; o.x = 1;
var d; var d;
with(o) with(o) {
{ d = delete x;
d = delete x; }
}
assert.sameValue(d, true, 'd'); assert.sameValue(d, true, 'd');
assert.sameValue(o.x, undefined, 'o.x'); assert.sameValue(o.x, undefined, 'o.x');

View File

@ -5,16 +5,13 @@
info: | info: |
This test is actually testing the [[Delete]] internal method (8.12.8). Since the This test is actually testing the [[Delete]] internal method (8.12.8). Since the
language provides no way to directly exercise [[Delete]], the tests are placed here. language provides no way to directly exercise [[Delete]], the tests are placed here.
es5id: 11.4.1-4.a-7 esid: sec-delete-operator-runtime-semantics-evaluation
description: delete operator inside 'eval' description: delete operator inside 'eval'
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function testcase() { var x = 1;
var x = 1; var d = eval('delete x');
var d = eval("delete x");
assert.sameValue(d, false, 'd'); assert.sameValue(d, false, 'd');
assert.sameValue(x, 1, 'x'); assert.sameValue(x, 1, 'x');
}
testcase();

View File

@ -5,7 +5,7 @@
info: | info: |
This test is actually testing the [[Delete]] internal method (8.12.8). Since the This test is actually testing the [[Delete]] internal method (8.12.8). Since the
language provides no way to directly exercise [[Delete]], the tests are placed here. language provides no way to directly exercise [[Delete]], the tests are placed here.
es5id: 11.4.1-4.a-8-s esid: sec-delete-operator-runtime-semantics-evaluation
description: > description: >
delete operator throws TypeError when deleting a non-configurable delete operator throws TypeError when deleting a non-configurable
data property in strict mode data property in strict mode
@ -13,7 +13,7 @@ flags: [onlyStrict]
---*/ ---*/
var global = this; var global = this;
// NaN (15.1.1.1) has [[Configurable]] set to false. // NaN (15.1.1.1) has [[Configurable]] set to false.
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
delete global.NaN; delete global.NaN;
}); });

View File

@ -5,7 +5,7 @@
info: | info: |
This test is actually testing the [[Delete]] internal method (8.12.8). Since the This test is actually testing the [[Delete]] internal method (8.12.8). Since the
language provides no way to directly exercise [[Delete]], the tests are placed here. language provides no way to directly exercise [[Delete]], the tests are placed here.
es5id: 11.4.1-4.a-8 esid: sec-delete-operator-runtime-semantics-evaluation
description: delete operator returns true for built-in objects (JSON) description: delete operator returns true for built-in objects (JSON)
flags: [noStrict] flags: [noStrict]
---*/ ---*/

View File

@ -5,14 +5,13 @@
info: | info: |
This test is actually testing the [[Delete]] internal method (8.12.8). Since the This test is actually testing the [[Delete]] internal method (8.12.8). Since the
language provides no way to directly exercise [[Delete]], the tests are placed here. language provides no way to directly exercise [[Delete]], the tests are placed here.
es5id: 11.4.1-4.a-9-s esid: sec-delete-operator-runtime-semantics-evaluation
description: > description: >
delete operator throws TypeError when deleting a non-configurable delete operator throws TypeError when deleting a non-configurable
data property (Math.LN2) in strict mode data property (Math.LN2) in strict mode
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
delete Math.LN2; delete Math.LN2;
}); });

View File

@ -5,13 +5,13 @@
info: | info: |
This test is actually testing the [[Delete]] internal method (8.12.8). Since the This test is actually testing the [[Delete]] internal method (8.12.8). Since the
language provides no way to directly exercise [[Delete]], the tests are placed here. language provides no way to directly exercise [[Delete]], the tests are placed here.
es5id: 11.4.1-4.a-9 esid: sec-delete-operator-runtime-semantics-evaluation
description: > description: >
delete operator returns false when deleting a non-configurable delete operator returns false when deleting a non-configurable
data property (Math.LN2) data property (Math.LN2)
flags: [noStrict] flags: [noStrict]
---*/ ---*/
var d = delete Math.LN2; var d = delete Math.LN2;
assert.sameValue(d, false, 'd'); assert.sameValue(d, false, 'd');

View File

@ -2,20 +2,17 @@
// 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.
/*--- /*---
es5id: 11.4.1-5-1 esid: sec-delete-operator-runtime-semantics-evaluation
description: > description: >
delete operator returns false when deleting a direct reference to delete operator returns false when deleting a direct reference to
a var a var
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function testcase() { var x = 1;
var x = 1;
// Now, deleting 'x' directly should fail; // Now, deleting 'x' directly should fail;
var d = delete x; var d = delete x;
assert.sameValue(d, false, 'd'); assert.sameValue(d, false, 'd');
assert.sameValue(x, 1, 'x'); assert.sameValue(x, 1, 'x');
}
testcase();

View File

@ -2,19 +2,18 @@
// 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.
/*--- /*---
es5id: 11.4.1-5-2 esid: sec-delete-operator-runtime-semantics-evaluation
description: > description: >
delete operator returns false when deleting a direct reference to delete operator returns false when deleting a direct reference to
a function argument a function argument
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function foo(a,b) { function foo(a, b) {
// Now, deleting 'a' directly should fail
// Now, deleting 'a' directly should fail // because 'a' is direct reference to a function argument;
// because 'a' is direct reference to a function argument; var d = delete a;
var d = delete a; return d === false && a === 1;
return (d === false && a === 1); }
}
assert(foo(1,2), 'foo(1,2) !== true'); assert(foo(1, 2), 'foo(1,2) !== true');

View File

@ -2,20 +2,17 @@
// 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.
/*--- /*---
es5id: 11.4.1-5-3 esid: sec-delete-operator-runtime-semantics-evaluation
description: > description: >
delete operator returns false when deleting a direct reference to delete operator returns false when deleting a direct reference to
a function name a function name
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function testcase() { var foo = function() {};
var foo = function(){};
// Now, deleting 'foo' directly should fail; // Now, deleting 'foo' directly should fail;
var d = delete foo; var d = delete foo;
assert.sameValue(d, false, 'd'); assert.sameValue(d, false, 'd');
assert.sameValue(typeof foo, 'function', 'typeof foo'); assert.sameValue(typeof foo, 'function', 'typeof foo');
}
testcase();

View File

@ -2,16 +2,21 @@
// 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.
/*--- /*---
es5id: 11.4.1-5-a-27-s esid: sec-delete-operator-runtime-semantics-evaluation
description: > description: >
Strict Mode - TypeError is thrown after deleting a property, Strict Mode - TypeError is thrown after deleting a property,
calling preventExtensions, and attempting to reassign the property calling preventExtensions, and attempting to reassign the property
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
var a = {x:0, get y() { return 0;}}; var a = {
delete a.x; x: 0,
Object.preventExtensions(a); get y() {
return 0;
},
};
delete a.x;
Object.preventExtensions(a);
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
a.x = 1; a.x = 1;
}); });

View File

@ -2,9 +2,9 @@
// 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.
/*--- /*---
es5id: 11.4.1-5-a-28-s esid: sec-delete-operator-runtime-semantics-evaluation
description: Strict Mode - TypeError is not thrown when deleting RegExp.length description: Strict Mode - TypeError is not thrown when deleting RegExp.length
---*/ ---*/
var a = new RegExp(); var a = new RegExp();
var b = delete RegExp.length; var b = delete RegExp.length;

View File

@ -5,18 +5,20 @@
info: | info: |
This test is actually testing the [[Delete]] internal method (8.12.8). Since the This test is actually testing the [[Delete]] internal method (8.12.8). Since the
language provides no way to directly exercise [[Delete]], the tests are placed here. language provides no way to directly exercise [[Delete]], the tests are placed here.
es5id: 11.4.4-4.a-3-s esid: sec-delete-operator-runtime-semantics-evaluation
description: > description: >
delete operator throws TypeError when deleting a non-configurable delete operator throws TypeError when deleting a non-configurable
data property in strict mode data property in strict mode
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
var o = {}; var o = {};
var desc = { value : 1 }; // all other attributes default to false var desc = {
Object.defineProperty(o, "foo", desc); value: 1,
}; // all other attributes default to false
// Now, deleting o.foo should throw TypeError because [[Configurable]] on foo is false. Object.defineProperty(o, 'foo', desc);
// Now, deleting o.foo should throw TypeError because [[Configurable]] on foo is false.
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
delete o.foo; delete o.foo;
}); });

View File

@ -3,7 +3,7 @@
/*--- /*---
info: If Type(x) is not Reference, return true info: If Type(x) is not Reference, return true
es5id: 11.4.1_A2.1 esid: sec-delete-operator-runtime-semantics-evaluation
description: Checking primitive value and Object value cases description: Checking primitive value and Object value cases
---*/ ---*/

View File

@ -3,7 +3,7 @@
/*--- /*---
info: If GetBase(x) doesn't have a property GetPropertyName(x), return true info: If GetBase(x) doesn't have a property GetPropertyName(x), return true
es5id: 11.4.1_A2.2_T1 esid: sec-delete-operator-runtime-semantics-evaluation
description: Checking undeclared variable case description: Checking undeclared variable case
flags: [noStrict] flags: [noStrict]
---*/ ---*/

View File

@ -3,15 +3,17 @@
/*--- /*---
info: If GetBase(x) doesn't have a property GetPropertyName(x), return true info: If GetBase(x) doesn't have a property GetPropertyName(x), return true
es5id: 11.4.1_A2.2_T2 esid: sec-delete-operator-runtime-semantics-evaluation
description: Checking Object object and Function object cases description: Checking Object object and Function object cases
---*/ ---*/
//CHECK#1 //CHECK#1
function MyFunction(){} function MyFunction() {}
var MyObject = new MyFunction(); var MyObject = new MyFunction();
if (delete MyObject.prop !== true) { if (delete MyObject.prop !== true) {
$ERROR('#1: function MyFunction(){}; var MyObject = new MyFunction(); delete MyObject.prop === true'); $ERROR(
'#1: function MyFunction(){}; var MyObject = new MyFunction(); delete MyObject.prop === true'
);
} }
//CHECK#2 //CHECK#2

View File

@ -3,7 +3,7 @@
/*--- /*---
info: If GetBase(x) doesn't have a property GetPropertyName(x), return true info: If GetBase(x) doesn't have a property GetPropertyName(x), return true
es5id: 11.4.1_A2.2_T3 esid: sec-delete-operator-runtime-semantics-evaluation
description: Checking undeclared variable case description: Checking undeclared variable case
---*/ ---*/

View File

@ -3,7 +3,7 @@
/*--- /*---
info: If the property has the DontDelete attribute, return false info: If the property has the DontDelete attribute, return false
es5id: 11.4.1_A3.1 esid: sec-delete-operator-runtime-semantics-evaluation
description: Checking declared variable description: Checking declared variable
flags: [noStrict] flags: [noStrict]
---*/ ---*/
@ -21,7 +21,7 @@ if (delete this.y !== false) {
} }
//CHECK#3 //CHECK#3
function MyFunction(){}; function MyFunction() {}
if (delete MyFunction !== false) { if (delete MyFunction !== false) {
$ERROR('#3: function MyFunction(){}; delete MyFunction === false'); $ERROR('#3: function MyFunction(){}; delete MyFunction === false');
} }
@ -29,5 +29,7 @@ if (delete MyFunction !== false) {
//CHECK#4 //CHECK#4
var MyObject = new MyFunction(); var MyObject = new MyFunction();
if (delete MyObject !== false) { if (delete MyObject !== false) {
$ERROR('#4: function MyFunction(){}; var MyObject = new MyFunction(); delete MyObject === false'); $ERROR(
'#4: function MyFunction(){}; var MyObject = new MyFunction(); delete MyObject === false'
);
} }

View File

@ -3,7 +3,7 @@
/*--- /*---
info: If the property doesn't have the DontDelete attribute, return true info: If the property doesn't have the DontDelete attribute, return true
es5id: 11.4.1_A3.2_T1 esid: sec-delete-operator-runtime-semantics-evaluation
description: Checking declared variable description: Checking declared variable
flags: [noStrict] flags: [noStrict]
---*/ ---*/

View File

@ -3,13 +3,15 @@
/*--- /*---
info: If the property doesn't have the DontDelete attribute, return true info: If the property doesn't have the DontDelete attribute, return true
es5id: 11.4.1_A3.2_T2 esid: sec-delete-operator-runtime-semantics-evaluation
description: Checking declared variable description: Checking declared variable
---*/ ---*/
//CHECK#1 //CHECK#1
function MyFunction(){}; function MyFunction() {}
MyFunction.prop = 1; MyFunction.prop = 1;
if (delete MyFunction.prop !== true) { if (delete MyFunction.prop !== true) {
$ERROR('#1: function MyFunction(){}; MyFunction.prop = 1; delete MyFunction.prop === true'); $ERROR(
'#1: function MyFunction(){}; MyFunction.prop = 1; delete MyFunction.prop === true'
);
} }

View File

@ -3,14 +3,16 @@
/*--- /*---
info: If the property doesn't have the DontDelete attribute, return true info: If the property doesn't have the DontDelete attribute, return true
es5id: 11.4.1_A3.2_T3 esid: sec-delete-operator-runtime-semantics-evaluation
description: Checking declared variable description: Checking declared variable
---*/ ---*/
//CHECK#1 //CHECK#1
function MyFunction(){}; function MyFunction() {}
var MyObject = new MyFunction(); var MyObject = new MyFunction();
MyObject.prop = 1; MyObject.prop = 1;
if (delete MyObject.prop !== true) { if (delete MyObject.prop !== true) {
$ERROR('#1: function MyFunction(){}; var MyObject = new MyFunction(); MyFunction.prop = 1; delete MyObject.prop === true'); $ERROR(
'#1: function MyFunction(){}; var MyObject = new MyFunction(); MyFunction.prop = 1; delete MyObject.prop === true'
);
} }

View File

@ -3,7 +3,7 @@
/*--- /*---
info: If the property doesn't have the DontDelete attribute, remove the property info: If the property doesn't have the DontDelete attribute, remove the property
es5id: 11.4.1_A3.3_T1 esid: sec-delete-operator-runtime-semantics-evaluation
description: Checking declared variable description: Checking declared variable
flags: [noStrict] flags: [noStrict]
---*/ ---*/

View File

@ -3,15 +3,17 @@
/*--- /*---
info: If the property doesn't have the DontDelete attribute, remove the property info: If the property doesn't have the DontDelete attribute, remove the property
es5id: 11.4.1_A3.3_T2 esid: sec-delete-operator-runtime-semantics-evaluation
description: Checking declared variable description: Checking declared variable
---*/ ---*/
//CHECK#1 //CHECK#1
function MyFunction(){}; function MyFunction() {}
MyFunction.prop = 1; MyFunction.prop = 1;
delete MyFunction.prop; delete MyFunction.prop;
if (MyFunction.prop !== undefined) { if (MyFunction.prop !== undefined) {
$ERROR('#1: function MyFunction(){}; MyFunction.prop = 1; delete MyFunction.prop; MyFunction.prop === undefined. Actual: ' + (MyFunction.prop)); $ERROR(
'#1: function MyFunction(){}; MyFunction.prop = 1; delete MyFunction.prop; MyFunction.prop === undefined. Actual: ' +
MyFunction.prop
);
} }

View File

@ -3,15 +3,18 @@
/*--- /*---
info: If the property doesn't have the DontDelete attribute, remove the property info: If the property doesn't have the DontDelete attribute, remove the property
es5id: 11.4.1_A3.3_T3 esid: sec-delete-operator-runtime-semantics-evaluation
description: Checking declared variable description: Checking declared variable
---*/ ---*/
//CHECK#1 //CHECK#1
function MyFunction(){}; function MyFunction() {}
var MyObjectVar = new MyFunction(); var MyObjectVar = new MyFunction();
MyObjectVar.prop = 1; MyObjectVar.prop = 1;
delete MyObjectVar.prop; delete MyObjectVar.prop;
if (MyObjectVar.prop !== undefined) { if (MyObjectVar.prop !== undefined) {
$ERROR('#1: function MyFunction(){}; var MyObjectVar = new MyFunction(); MyFunction.prop = 1; delete MyObjectVar.prop; MyObjectVar.prop === undefined. Actual: ' + (MyObjectVar.prop)); $ERROR(
'#1: function MyFunction(){}; var MyObjectVar = new MyFunction(); MyFunction.prop = 1; delete MyObjectVar.prop; MyObjectVar.prop === undefined. Actual: ' +
MyObjectVar.prop
);
} }

View File

@ -3,14 +3,16 @@
/*--- /*---
info: If the property doesn't have the DontDelete attribute, remove the property info: If the property doesn't have the DontDelete attribute, remove the property
es5id: 11.4.1_A3.3_T4 esid: sec-delete-operator-runtime-semantics-evaluation
description: Checking declared variable description: Checking declared variable
flags: [noStrict] flags: [noStrict]
---*/ ---*/
//CHECK#1 //CHECK#1
function MyFunction(){}; function MyFunction() {}
var MyObjectVar = new MyFunction(); var MyObjectVar = new MyFunction();
if (delete MyObjectVar !== false) { if (delete MyObjectVar !== false) {
$ERROR('#1: function MyFunction(){}; var MyObjectVar = new MyFunction(); delete MyObjectVar === false'); $ERROR(
'#1: function MyFunction(){}; var MyObjectVar = new MyFunction(); delete MyObjectVar === false'
);
} }

View File

@ -3,16 +3,19 @@
/*--- /*---
info: If the property doesn't have the DontDelete attribute, remove the property info: If the property doesn't have the DontDelete attribute, remove the property
es5id: 11.4.1_A3.3_T5 esid: sec-delete-operator-runtime-semantics-evaluation
description: Checking declared variable description: Checking declared variable
flags: [noStrict] flags: [noStrict]
---*/ ---*/
//CHECK#1 //CHECK#1
function MyFunction(){}; function MyFunction() {}
MyObjectNotVar = new MyFunction(); MyObjectNotVar = new MyFunction();
MyObjectNotVar.prop = 1; MyObjectNotVar.prop = 1;
delete MyObjectNotVar.prop; delete MyObjectNotVar.prop;
if (MyObjectNotVar.prop !== undefined) { if (MyObjectNotVar.prop !== undefined) {
$ERROR('#1: function MyFunction(){}; MyObjectNotVar = new MyFunction(); MyFunction.prop = 1; delete MyObjectNotVar.prop; MyObjectNotVar.prop === undefined. Actual: ' + (MyObjectNotVar.prop)); $ERROR(
'#1: function MyFunction(){}; MyObjectNotVar = new MyFunction(); MyFunction.prop = 1; delete MyObjectNotVar.prop; MyObjectNotVar.prop === undefined. Actual: ' +
MyObjectNotVar.prop
);
} }

View File

@ -3,14 +3,16 @@
/*--- /*---
info: If the property doesn't have the DontDelete attribute, remove the property info: If the property doesn't have the DontDelete attribute, remove the property
es5id: 11.4.1_A3.3_T6 esid: sec-delete-operator-runtime-semantics-evaluation
description: Checking declared variable description: Checking declared variable
flags: [noStrict] flags: [noStrict]
---*/ ---*/
//CHECK#1 //CHECK#1
function MyFunction(){}; function MyFunction() {}
var MyObjectVar = new MyFunction(); var MyObjectVar = new MyFunction();
if (delete MyObjectNotVar !== true) { if (delete MyObjectNotVar !== true) {
$ERROR('#1: function MyFunction(){}; var MyObjectNotVar = new MyFunction(); delete MyObjectNotVar === true'); $ERROR(
'#1: function MyFunction(){}; var MyObjectNotVar = new MyFunction(); delete MyObjectNotVar === true'
);
} }

View File

@ -5,7 +5,7 @@
info: | info: |
"Delete" operator removes property, which is reference to the object, not "Delete" operator removes property, which is reference to the object, not
the object the object
es5id: 11.4.1_A4 esid: sec-delete-operator-runtime-semantics-evaluation
description: Checking two reference by one object description: Checking two reference by one object
flags: [noStrict] flags: [noStrict]
---*/ ---*/
@ -14,6 +14,9 @@ flags: [noStrict]
var obj = new Object(); var obj = new Object();
var ref = obj; var ref = obj;
delete ref; delete ref;
if (typeof obj !== "object") { if (typeof obj !== 'object') {
$ERROR('#1: obj = new Object(); ref = obj; delete ref; typeof obj === "object". Actual: ' + (typeof obj)); $ERROR(
'#1: obj = new Object(); ref = obj; delete ref; typeof obj === "object". Actual: ' +
typeof obj
);
} }

View File

@ -6,7 +6,7 @@ info: |
A strict delete should either succeed, returning true, or it A strict delete should either succeed, returning true, or it
should fail by throwing a TypeError. Under no circumstances should fail by throwing a TypeError. Under no circumstances
should a strict delete return false. should a strict delete return false.
es5id: 11.4.1_A5 esid: sec-delete-operator-runtime-semantics-evaluation
description: > description: >
See if a strict delete returns false when deleting a non-standard See if a strict delete returns false when deleting a non-standard
property. property.

View File

@ -5,23 +5,23 @@
info: | info: |
When the [[Delete]] method of O is called with property name P, When the [[Delete]] method of O is called with property name P,
and If the property has the DontDelete attribute, return false and If the property has the DontDelete attribute, return false
es5id: 8.12.7_A1 esid: sec-delete-operator-runtime-semantics-evaluation
description: Try to delete Math.E, that has the DontDelete attribute description: Try to delete Math.E, that has the DontDelete attribute
flags: [noStrict] flags: [noStrict]
---*/ ---*/
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
//CHECK#1 //CHECK#1
if (delete Math.E !== false){ if (delete Math.E !== false) {
$ERROR('#1: delete Math.E === false. Actual: ' + (delete Math.E)); $ERROR('#1: delete Math.E === false. Actual: ' + delete Math.E);
}; }
// //
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
//CHECK#2 //CHECK#2
if (Math.E === undefined){ if (Math.E === undefined) {
$ERROR('#2: delete Math.E; Math.E !== undefined'); $ERROR('#2: delete Math.E; Math.E !== undefined');
}; }
// //
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////

View File

@ -5,7 +5,7 @@
info: | info: |
When the [[Delete]] method of O is called with property name P, When the [[Delete]] method of O is called with property name P,
and if O doesn't have a property with name P, return true and if O doesn't have a property with name P, return true
es5id: 8.12.7_A2_T1 esid: sec-delete-operator-runtime-semantics-evaluation
description: Try to delete not existent properties description: Try to delete not existent properties
---*/ ---*/
@ -13,25 +13,34 @@ var __color__map = {};
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
//CHECK#1 //CHECK#1
if (delete __color__map.red !== true){ if (delete __color__map.red !== true) {
$ERROR('#1: var __color__map = {}; delete __color__map.red === true. Actual: ' + (delete __color__map.red)); $ERROR(
}; '#1: var __color__map = {}; delete __color__map.red === true. Actual: ' +
delete __color__map.red
);
}
// //
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
//CHECK#2 //CHECK#2
if (delete __color__map["green"] !== true){ if (delete __color__map['green'] !== true) {
$ERROR('#2: var __color__map = {}; delete __color__map["green"] === true. Actual: ' + (delete __color__map["green"])); $ERROR(
}; '#2: var __color__map = {}; delete __color__map["green"] === true. Actual: ' +
delete __color__map['green']
);
}
// //
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
//CHECK#3 //CHECK#3
var blue = 1; var blue = 1;
if (delete __color__map[blue] !== true){ if (delete __color__map[blue] !== true) {
$ERROR('#3: var __color__map = {}; var blue = 1; delete __color__map[blue] === true. Actual: ' + (delete __color__map[blue])); $ERROR(
}; '#3: var __color__map = {}; var blue = 1; delete __color__map[blue] === true. Actual: ' +
delete __color__map[blue]
);
}
// //
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////

View File

@ -5,20 +5,26 @@
info: | info: |
When the [[Delete]] method of O is called with property name P, When the [[Delete]] method of O is called with property name P,
and if O doesn't have a property with name P, return true and if O doesn't have a property with name P, return true
es5id: 8.12.7_A2_T2 esid: sec-delete-operator-runtime-semantics-evaluation
description: > description: >
Try to delete not existent properties of O, but existent property Try to delete not existent properties of O, but existent property
of prototype of prototype
---*/ ---*/
function Palette(){}; function Palette() {}
Palette.prototype = {red:0xFF0000, green:0x00FF00}; Palette.prototype = {
var __palette = new Palette; red: 0xff0000,
green: 0x00ff00,
};
var __palette = new Palette();
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
//CHECK#1 //CHECK#1
if (__palette.red !== 0xFF0000){ if (__palette.red !== 0xff0000) {
$ERROR('#1: function Palette(){}; Palette.prototype = {red:0xFF0000, green:0x00FF00}; __palette = new Palette; __palette.red === 0xFF0000. Actual: ' + (__palette.red)); $ERROR(
'#1: function Palette(){}; Palette.prototype = {red:0xFF0000, green:0x00FF00}; __palette = new Palette; __palette.red === 0xFF0000. Actual: ' +
__palette.red
);
} }
// //
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
@ -26,15 +32,21 @@ if (__palette.red !== 0xFF0000){
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
//CHECK#2 //CHECK#2
if (delete __palette.red !== true) { if (delete __palette.red !== true) {
$ERROR('#2 function Palette(){}; Palette.prototype = {red:0xFF0000, green:0x00FF00}; __palette = new Palette; delete __palette.red === true. Actual: ' + (delete __palette.red)); $ERROR(
'#2 function Palette(){}; Palette.prototype = {red:0xFF0000, green:0x00FF00}; __palette = new Palette; delete __palette.red === true. Actual: ' +
delete __palette.red
);
} }
// //
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
//CHECK#3 //CHECK#3
if (__palette.red !== 0xFF0000){ if (__palette.red !== 0xff0000) {
$ERROR('#3: function Palette(){}; Palette.prototype = {red:0xFF0000, green:0x00FF00}; __palette = new Palette; __palette.red === 0xFF0000. Actual: ' + (__palette.red)); $ERROR(
'#3: function Palette(){}; Palette.prototype = {red:0xFF0000, green:0x00FF00}; __palette = new Palette; __palette.red === 0xFF0000. Actual: ' +
__palette.red
);
} }
// //
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////

View File

@ -5,44 +5,60 @@
info: | info: |
When the [[Delete]] method of O is called with property name P, When the [[Delete]] method of O is called with property name P,
removes the property with name P from O and return true removes the property with name P from O and return true
es5id: 8.12.7_A3 esid: sec-delete-operator-runtime-semantics-evaluation
description: Delete existent properties description: Delete existent properties
---*/ ---*/
var BLUE_NUM=1; var BLUE_NUM = 1;
var BLUE_STR="1"; var BLUE_STR = '1';
var YELLOW_NUM=2; var YELLOW_NUM = 2;
var YELLOW_STR="2"; var YELLOW_STR = '2';
var __color__map = {red:0xFF0000, BLUE_NUM:0x0000FF, green:0x00FF00, YELLOW_STR:0xFFFF00}; var __color__map = {
red: 0xff0000,
BLUE_NUM: 0x0000ff,
green: 0x00ff00,
YELLOW_STR: 0xffff00,
};
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
//CHECK#1 //CHECK#1
if (delete __color__map[YELLOW_NUM] !== true){ if (delete __color__map[YELLOW_NUM] !== true) {
$ERROR('#1: var BLUE_NUM=1; var BLUE_STR="1"; var YELLOW_NUM=2; var YELLOW_STR="2"; var __color__map = {red:0xFF0000, BLUE_NUM:0x0000FF, green:0x00FF00, YELLOW_STR:0xFFFF00}; delete __color__map[YELLOW_NUM] === true;'); $ERROR(
}; '#1: var BLUE_NUM=1; var BLUE_STR="1"; var YELLOW_NUM=2; var YELLOW_STR="2"; var __color__map = {red:0xFF0000, BLUE_NUM:0x0000FF, green:0x00FF00, YELLOW_STR:0xFFFF00}; delete __color__map[YELLOW_NUM] === true;'
);
}
// //
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
//CHECK#2 //CHECK#2
if (__color__map[YELLOW_STR] !== undefined) { if (__color__map[YELLOW_STR] !== undefined) {
$ERROR('#2: var BLUE_NUM=1; var BLUE_STR="1"; var YELLOW_NUM=2; var YELLOW_STR="2"; var __color__map = {red:0xFF0000, BLUE_NUM:0x0000FF, green:0x00FF00, YELLOW_STR:0xFFFF00}; delete __color__map[YELLOW_NUM]; __color__map[YELLOW_STR] === undefined. Actual: ' + (__color__map[YELLOW_STR])); $ERROR(
'#2: var BLUE_NUM=1; var BLUE_STR="1"; var YELLOW_NUM=2; var YELLOW_STR="2"; var __color__map = {red:0xFF0000, BLUE_NUM:0x0000FF, green:0x00FF00, YELLOW_STR:0xFFFF00}; delete __color__map[YELLOW_NUM]; __color__map[YELLOW_STR] === undefined. Actual: ' +
__color__map[YELLOW_STR]
);
} }
// //
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
//CHECK#3 //CHECK#3
if (delete __color__map[BLUE_STR] !== true){ if (delete __color__map[BLUE_STR] !== true) {
$ERROR('#3: var BLUE_NUM=1; var BLUE_STR="1"; var YELLOW_NUM=2; var YELLOW_STR="2"; var __color__map = {red:0xFF0000, BLUE_NUM:0x0000FF, green:0x00FF00, YELLOW_STR:0xFFFF00}; delete __color__map[BLUE_STR] === true. Actual: ' + (delete __color__map[BLUE_STR])); $ERROR(
}; '#3: var BLUE_NUM=1; var BLUE_STR="1"; var YELLOW_NUM=2; var YELLOW_STR="2"; var __color__map = {red:0xFF0000, BLUE_NUM:0x0000FF, green:0x00FF00, YELLOW_STR:0xFFFF00}; delete __color__map[BLUE_STR] === true. Actual: ' +
delete __color__map[BLUE_STR]
);
}
// //
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
//CHECK#4 //CHECK#4
if (__color__map[BLUE_NUM] !== undefined) { if (__color__map[BLUE_NUM] !== undefined) {
$ERROR('#4: var BLUE_NUM=1; var BLUE_STR="1"; var YELLOW_NUM=2; var YELLOW_STR="2"; var __color__map = {red:0xFF0000, BLUE_NUM:0x0000FF, green:0x00FF00, YELLOW_STR:0xFFFF00}; delete __color__map[BLUE_STR]; __color__map[BLUE_NUM] === undefined. Actual: ' + (__color__map[BLUE_NUM])); $ERROR(
'#4: var BLUE_NUM=1; var BLUE_STR="1"; var YELLOW_NUM=2; var YELLOW_STR="2"; var __color__map = {red:0xFF0000, BLUE_NUM:0x0000FF, green:0x00FF00, YELLOW_STR:0xFFFF00}; delete __color__map[BLUE_STR]; __color__map[BLUE_NUM] === undefined. Actual: ' +
__color__map[BLUE_NUM]
);
} }
// //
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////

View File

@ -7,7 +7,9 @@ features: [class]
---*/ ---*/
class X { class X {
method() { return this; } method() {
return this;
}
} }
class Y extends X { class Y extends X {