mirror of https://github.com/tc39/test262.git
Replace runTestCase with assert helpers [test/language/expressions/delete]
This commit is contained in:
parent
ba8a41efe9
commit
4eac0d909e
|
@ -6,15 +6,12 @@ es5id: 11.4.1-2-2
|
||||||
description: >
|
description: >
|
||||||
delete operator returns true when deleting returned value from a
|
delete operator returns true when deleting returned value from a
|
||||||
function
|
function
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
var bIsFooCalled = false;
|
var bIsFooCalled = false;
|
||||||
var foo = function(){bIsFooCalled = true;};
|
var foo = function(){bIsFooCalled = true;};
|
||||||
|
|
||||||
var d = delete foo();
|
var d = delete foo();
|
||||||
if(d === true && bIsFooCalled === true)
|
|
||||||
return true;
|
assert.sameValue(d, true, 'd');
|
||||||
}
|
assert.sameValue(bIsFooCalled, true, 'bIsFooCalled');
|
||||||
runTestCase(testcase);
|
|
||||||
|
|
|
@ -6,13 +6,8 @@ es5id: 11.4.1-2-3
|
||||||
description: >
|
description: >
|
||||||
delete operator returns true when deleting a non-reference
|
delete operator returns true when deleting a non-reference
|
||||||
(boolean)
|
(boolean)
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
var d = delete true;
|
var d = delete true;
|
||||||
if (d === true) {
|
|
||||||
return true;
|
assert.sameValue(d, true, 'd');
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
|
|
@ -4,13 +4,8 @@
|
||||||
/*---
|
/*---
|
||||||
es5id: 11.4.1-2-4
|
es5id: 11.4.1-2-4
|
||||||
description: delete operator returns true when deleting a non-reference (string)
|
description: delete operator returns true when deleting a non-reference (string)
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
var d = delete "abc";
|
var d = delete "abc";
|
||||||
if (d === true) {
|
|
||||||
return true;
|
assert.sameValue(d, true, 'd');
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
|
|
@ -4,13 +4,8 @@
|
||||||
/*---
|
/*---
|
||||||
es5id: 11.4.1-2-5
|
es5id: 11.4.1-2-5
|
||||||
description: delete operator returns true when deleting a non-reference (obj)
|
description: delete operator returns true when deleting a non-reference (obj)
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
var d = delete {a:0} ;
|
var d = delete {a:0} ;
|
||||||
if (d === true) {
|
|
||||||
return true;
|
assert.sameValue(d, true, 'd');
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
|
|
@ -4,13 +4,8 @@
|
||||||
/*---
|
/*---
|
||||||
es5id: 11.4.1-2-6
|
es5id: 11.4.1-2-6
|
||||||
description: delete operator returns true when deleting a non-reference (null)
|
description: delete operator returns true when deleting a non-reference (null)
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
var d = delete null;
|
var d = delete null;
|
||||||
if (d === true) {
|
|
||||||
return true;
|
assert.sameValue(d, true, 'd');
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
|
|
@ -7,14 +7,9 @@ description: >
|
||||||
delete operator returns true when deleting an unresolvable
|
delete operator returns true when deleting an unresolvable
|
||||||
reference
|
reference
|
||||||
flags: [noStrict]
|
flags: [noStrict]
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
// just cooking up a long/veryLikely unique name
|
// just cooking up a long/veryLikely unique name
|
||||||
var d = delete __ES3_1_test_suite_test_11_4_1_3_unique_id_0__;
|
var d = delete __ES3_1_test_suite_test_11_4_1_3_unique_id_0__;
|
||||||
if (d === true) {
|
|
||||||
return true;
|
assert.sameValue(d, true, 'd');
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
|
|
@ -6,14 +6,9 @@ es5id: 11.4.1-3-3
|
||||||
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)
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
var __ES3_1_test_suite_test_11_4_1_3_unique_id_3__ = {};
|
var __ES3_1_test_suite_test_11_4_1_3_unique_id_3__ = {};
|
||||||
var d = delete __ES3_1_test_suite_test_11_4_1_3_unique_id_3__.x;
|
var d = delete __ES3_1_test_suite_test_11_4_1_3_unique_id_3__.x;
|
||||||
if (d === true) {
|
|
||||||
return true;
|
assert.sameValue(d, true, 'd');
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
|
|
@ -5,10 +5,8 @@
|
||||||
es5id: 11.4.1-4-a-3-s
|
es5id: 11.4.1-4-a-3-s
|
||||||
description: >
|
description: >
|
||||||
TypeError isn't thrown when deleting configurable data property
|
TypeError isn't thrown when deleting configurable data property
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
var obj = {};
|
var obj = {};
|
||||||
Object.defineProperty(obj, "prop", {
|
Object.defineProperty(obj, "prop", {
|
||||||
value: "abc",
|
value: "abc",
|
||||||
|
@ -16,6 +14,5 @@ function testcase() {
|
||||||
});
|
});
|
||||||
|
|
||||||
delete obj.prop;
|
delete obj.prop;
|
||||||
return !obj.hasOwnProperty("prop");
|
|
||||||
}
|
assert.sameValue(obj.hasOwnProperty("prop"), false, 'obj.hasOwnProperty("prop")');
|
||||||
runTestCase(testcase);
|
|
||||||
|
|
|
@ -5,10 +5,8 @@
|
||||||
es5id: 11.4.1-4-a-4-s
|
es5id: 11.4.1-4-a-4-s
|
||||||
description: >
|
description: >
|
||||||
TypeError isn't thrown when deleting configurable accessor property
|
TypeError isn't thrown when deleting configurable accessor property
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
var obj = {};
|
var obj = {};
|
||||||
Object.defineProperty(obj, "prop", {
|
Object.defineProperty(obj, "prop", {
|
||||||
get: function () {
|
get: function () {
|
||||||
|
@ -18,6 +16,5 @@ function testcase() {
|
||||||
});
|
});
|
||||||
|
|
||||||
delete obj.prop;
|
delete obj.prop;
|
||||||
return !obj.hasOwnProperty("prop");
|
|
||||||
}
|
assert.sameValue(obj.hasOwnProperty("prop"), false, 'obj.hasOwnProperty("prop")');
|
||||||
runTestCase(testcase);
|
|
||||||
|
|
|
@ -9,18 +9,14 @@ es5id: 11.4.1-4.a-1
|
||||||
description: >
|
description: >
|
||||||
delete operator returns true when deleting a configurable data
|
delete operator returns true when deleting a configurable data
|
||||||
property
|
property
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
var o = {};
|
var o = {};
|
||||||
|
|
||||||
var desc = { value: 1, configurable: true };
|
var desc = { value: 1, configurable: true };
|
||||||
Object.defineProperty(o, "foo", desc);
|
Object.defineProperty(o, "foo", desc);
|
||||||
|
|
||||||
var d = delete o.foo;
|
var d = delete o.foo;
|
||||||
if (d === true && o.hasOwnProperty("foo") === false) {
|
|
||||||
return true;
|
assert.sameValue(d, true, 'd');
|
||||||
}
|
assert.sameValue(o.hasOwnProperty("foo"), false, 'o.hasOwnProperty("foo")');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
|
|
@ -8,15 +8,11 @@ info: >
|
||||||
es5id: 11.4.1-4.a-12
|
es5id: 11.4.1-4.a-12
|
||||||
description: delete operator returns false when deleting a property(length)
|
description: delete operator returns false when deleting a property(length)
|
||||||
flags: [noStrict]
|
flags: [noStrict]
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
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
|
||||||
if(d === false && a.length === 3)
|
|
||||||
return true;
|
assert.sameValue(d, false, 'd');
|
||||||
}
|
assert.sameValue(a.length, 3, 'a.length');
|
||||||
runTestCase(testcase);
|
|
||||||
|
|
|
@ -7,15 +7,11 @@ info: >
|
||||||
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
|
es5id: 11.4.1-4.a-14
|
||||||
description: delete operator returns true when deleting Array elements
|
description: delete operator returns true when deleting Array elements
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
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]
|
||||||
if(d === true && a[1] === undefined)
|
|
||||||
return true;
|
assert.sameValue(d, true, 'd');
|
||||||
}
|
assert.sameValue(a[1], undefined, 'a[1]');
|
||||||
runTestCase(testcase);
|
|
||||||
|
|
|
@ -7,15 +7,11 @@ info: >
|
||||||
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
|
es5id: 11.4.1-4.a-15
|
||||||
description: delete operator returns true when deleting Array expandos
|
description: delete operator returns true when deleting Array expandos
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
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;
|
||||||
if( d === true && a.x === undefined)
|
|
||||||
return true;
|
assert.sameValue(d, true, 'd');
|
||||||
}
|
assert.sameValue(a.x, undefined, 'a.x');
|
||||||
runTestCase(testcase);
|
|
||||||
|
|
|
@ -9,10 +9,8 @@ es5id: 11.4.1-4.a-2
|
||||||
description: >
|
description: >
|
||||||
delete operator returns true when deleting a configurable accessor
|
delete operator returns true when deleting a configurable accessor
|
||||||
property
|
property
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
var o = {};
|
var o = {};
|
||||||
|
|
||||||
// define an accessor
|
// define an accessor
|
||||||
|
@ -22,8 +20,6 @@ function testcase() {
|
||||||
Object.defineProperty(o, "foo", desc);
|
Object.defineProperty(o, "foo", desc);
|
||||||
|
|
||||||
var d = delete o.foo;
|
var d = delete o.foo;
|
||||||
if (d === true && o.hasOwnProperty("foo") === false) {
|
|
||||||
return true;
|
assert.sameValue(d, true, 'd');
|
||||||
}
|
assert.sameValue(o.hasOwnProperty("foo"), false, 'o.hasOwnProperty("foo")');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
|
|
@ -10,18 +10,14 @@ 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]
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
var o = {};
|
var o = {};
|
||||||
var desc = { value : 1, configurable: false }; // all other attributes default to false
|
var desc = { value : 1, configurable: false }; // all other attributes default to false
|
||||||
Object.defineProperty(o, "foo", desc);
|
Object.defineProperty(o, "foo", desc);
|
||||||
|
|
||||||
// Now, deleting o.foo should fail because [[Configurable]] on foo is false.
|
// Now, deleting o.foo should fail because [[Configurable]] on foo is false.
|
||||||
var d = delete o.foo;
|
var d = delete o.foo;
|
||||||
if (d === false && o.hasOwnProperty("foo") === true) {
|
|
||||||
return true;
|
assert.sameValue(d, false, 'd');
|
||||||
}
|
assert.sameValue(o.hasOwnProperty("foo"), true, 'o.hasOwnProperty("foo")');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
|
|
@ -10,14 +10,9 @@ 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]
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
// 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;
|
||||||
if (d === false) {
|
|
||||||
return true;
|
assert.sameValue(d, false, 'd');
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
|
|
@ -8,10 +8,8 @@ info: >
|
||||||
es5id: 11.4.1-4.a-6
|
es5id: 11.4.1-4.a-6
|
||||||
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]
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
var o = new Object();
|
var o = new Object();
|
||||||
o.x = 1;
|
o.x = 1;
|
||||||
var d;
|
var d;
|
||||||
|
@ -19,8 +17,6 @@ function testcase() {
|
||||||
{
|
{
|
||||||
d = delete x;
|
d = delete x;
|
||||||
}
|
}
|
||||||
if (d === true && o.x === undefined) {
|
|
||||||
return true;
|
assert.sameValue(d, true, 'd');
|
||||||
}
|
assert.sameValue(o.x, undefined, 'o.x');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
|
|
@ -10,13 +10,8 @@ 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]
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
var d = delete Math.LN2;
|
var d = delete Math.LN2;
|
||||||
if (d === false) {
|
|
||||||
return true;
|
assert.sameValue(d, false, 'd');
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
|
|
@ -7,11 +7,8 @@ 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]
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function foo(a,b) {
|
function foo(a,b) {
|
||||||
|
|
||||||
// Now, deleting 'a' directly should fail
|
// Now, deleting 'a' directly should fail
|
||||||
|
@ -19,6 +16,5 @@ function testcase() {
|
||||||
var d = delete a;
|
var d = delete a;
|
||||||
return (d === false && a === 1);
|
return (d === false && a === 1);
|
||||||
}
|
}
|
||||||
return foo(1,2);
|
|
||||||
}
|
assert(foo(1,2), 'foo(1,2) !== true');
|
||||||
runTestCase(testcase);
|
|
||||||
|
|
|
@ -4,12 +4,7 @@
|
||||||
/*---
|
/*---
|
||||||
es5id: 11.4.1-5-a-28-s
|
es5id: 11.4.1-5-a-28-s
|
||||||
description: Strict Mode - TypeError is not thrown when deleting RegExp.length
|
description: Strict Mode - TypeError is not thrown when deleting RegExp.length
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
var a = new RegExp();
|
var a = new RegExp();
|
||||||
var b = delete RegExp.length;
|
var b = delete RegExp.length;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
|
Loading…
Reference in New Issue