mirror of https://github.com/tc39/test262.git
Replace runTestCase with assert helpers [test/built-ins/Object/{freeze, preventExtensions, seal}]
This commit is contained in:
parent
4facaaab5f
commit
9cc4016866
|
@ -4,13 +4,8 @@
|
|||
/*---
|
||||
es5id: 15.2.3.9-0-1
|
||||
description: Object.freeze must exist as a function
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var f = Object.freeze;
|
||||
if (typeof(f) === "function") {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(typeof(f), "function", 'typeof(f)');
|
||||
|
|
|
@ -4,12 +4,6 @@
|
|||
/*---
|
||||
es5id: 15.2.3.9-0-2
|
||||
description: Object.freeze must exist as a function taking 1 parameter
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
if (Object.freeze.length === 1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(Object.freeze.length, 1, 'Object.freeze.length');
|
||||
|
|
|
@ -6,11 +6,6 @@ es5id: 15.2.3.9-1-1
|
|||
description: >
|
||||
Object.freeze does not throw TypeError if type of first param is
|
||||
undefined
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
Object.freeze(undefined);
|
||||
return true;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
|
|
@ -6,11 +6,6 @@ es5id: 15.2.3.9-1-2
|
|||
description: >
|
||||
Object.freeze does not throw TypeError if type of first param is
|
||||
null
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
Object.freeze(null);
|
||||
return true;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
|
|
@ -6,12 +6,7 @@ es5id: 15.2.3.9-1-3
|
|||
description: >
|
||||
Object.freeze does not throw TypeError if type of first param is
|
||||
boolean primitive
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
Object.freeze(false);
|
||||
Object.freeze(true);
|
||||
return true;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
|
|
@ -6,11 +6,6 @@ es5id: 15.2.3.9-1-4
|
|||
description: >
|
||||
Object.freeze does not throw TypeError if type of first param is
|
||||
string primitive
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
Object.freeze("abc");
|
||||
return true;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
|
|
@ -6,11 +6,6 @@ es5id: 15.2.3.9-1
|
|||
description: >
|
||||
Object.freeze does not throw TypeError if type of first param is
|
||||
not Object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
Object.freeze(0);
|
||||
return true;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
|
|
@ -6,14 +6,10 @@ es5id: 15.2.3.9-2-1
|
|||
description: >
|
||||
Object.freeze - extensible of 'O' is set as false even if 'O' has
|
||||
no own property
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var obj = {};
|
||||
|
||||
Object.freeze(obj);
|
||||
|
||||
return !Object.isExtensible(obj);
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(Object.isExtensible(obj), false, 'Object.isExtensible(obj)');
|
||||
|
|
|
@ -4,10 +4,8 @@
|
|||
/*---
|
||||
es5id: 15.2.3.9-2-2
|
||||
description: Object.freeze - inherited data properties are not frozen
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var proto = {};
|
||||
|
||||
Object.defineProperty(proto, "Father", {
|
||||
|
@ -25,6 +23,5 @@ function testcase() {
|
|||
delete proto.Father;
|
||||
var afterDeleted = proto.hasOwnProperty("Father");
|
||||
|
||||
return beforeDeleted && !afterDeleted;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(beforeDeleted, 'beforeDeleted !== true');
|
||||
assert.sameValue(afterDeleted, false, 'afterDeleted');
|
||||
|
|
|
@ -4,10 +4,8 @@
|
|||
/*---
|
||||
es5id: 15.2.3.9-2-3
|
||||
description: Object.freeze - inherited accessor properties are not frozen
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var proto = {};
|
||||
|
||||
Object.defineProperty(proto, "Father", {
|
||||
|
@ -27,6 +25,5 @@ function testcase() {
|
|||
delete proto.Father;
|
||||
var afterDeleted = proto.hasOwnProperty("Father");
|
||||
|
||||
return beforeDeleted && !afterDeleted;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(beforeDeleted, 'beforeDeleted !== true');
|
||||
assert.sameValue(afterDeleted, false, 'afterDeleted');
|
||||
|
|
|
@ -4,14 +4,10 @@
|
|||
/*---
|
||||
es5id: 15.2.3.9-2-d-1
|
||||
description: Object.freeze - 'O' is a Function object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var funObj = function () { };
|
||||
|
||||
Object.freeze(funObj);
|
||||
|
||||
return Object.isFrozen(funObj);
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(Object.isFrozen(funObj), 'Object.isFrozen(funObj) !== true');
|
||||
|
|
|
@ -4,14 +4,10 @@
|
|||
/*---
|
||||
es5id: 15.2.3.9-2-d-2
|
||||
description: Object.freeze - 'O' is an Array object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var arrObj = [0, 1];
|
||||
|
||||
Object.freeze(arrObj);
|
||||
|
||||
return Object.isFrozen(arrObj);
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(Object.isFrozen(arrObj), 'Object.isFrozen(arrObj) !== true');
|
||||
|
|
|
@ -4,14 +4,10 @@
|
|||
/*---
|
||||
es5id: 15.2.3.9-2-d-3
|
||||
description: Object.freeze - 'O' is a String object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var strObj = new String("a");
|
||||
|
||||
Object.freeze(strObj);
|
||||
|
||||
return Object.isFrozen(strObj);
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(Object.isFrozen(strObj), 'Object.isFrozen(strObj) !== true');
|
||||
|
|
|
@ -4,14 +4,10 @@
|
|||
/*---
|
||||
es5id: 15.2.3.9-2-d-4
|
||||
description: Object.freeze - 'O' is a Boolean object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var boolObj = new Boolean(false);
|
||||
|
||||
Object.freeze(boolObj);
|
||||
|
||||
return Object.isFrozen(boolObj);
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(Object.isFrozen(boolObj), 'Object.isFrozen(boolObj) !== true');
|
||||
|
|
|
@ -4,14 +4,10 @@
|
|||
/*---
|
||||
es5id: 15.2.3.9-2-d-5
|
||||
description: Object.freeze - 'O' is a Number object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var numObj = new Number(3);
|
||||
|
||||
Object.freeze(numObj);
|
||||
|
||||
return Object.isFrozen(numObj);
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(Object.isFrozen(numObj), 'Object.isFrozen(numObj) !== true');
|
||||
|
|
|
@ -4,14 +4,10 @@
|
|||
/*---
|
||||
es5id: 15.2.3.9-2-d-6
|
||||
description: Object.freeze - 'O' is a Date object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var dateObj = new Date();
|
||||
|
||||
Object.freeze(dateObj);
|
||||
|
||||
return Object.isFrozen(dateObj);
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(Object.isFrozen(dateObj), 'Object.isFrozen(dateObj) !== true');
|
||||
|
|
|
@ -4,14 +4,10 @@
|
|||
/*---
|
||||
es5id: 15.2.3.9-2-d-7
|
||||
description: Object.freeze - 'O' is a RegExp object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var regObj = new RegExp();
|
||||
|
||||
Object.freeze(regObj);
|
||||
|
||||
return Object.isFrozen(regObj);
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(Object.isFrozen(regObj), 'Object.isFrozen(regObj) !== true');
|
||||
|
|
|
@ -4,14 +4,10 @@
|
|||
/*---
|
||||
es5id: 15.2.3.9-2-d-8
|
||||
description: Object.freeze - 'O' is an Error object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var errObj = new SyntaxError();
|
||||
|
||||
Object.freeze(errObj);
|
||||
|
||||
return Object.isFrozen(errObj);
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(Object.isFrozen(errObj), 'Object.isFrozen(errObj) !== true');
|
||||
|
|
|
@ -4,15 +4,10 @@
|
|||
/*---
|
||||
es5id: 15.2.3.9-2-d-9
|
||||
description: Object.freeze - 'O' is the Arguments object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var argObj = (function () { return arguments; } ());
|
||||
|
||||
Object.freeze(argObj);
|
||||
|
||||
return Object.isFrozen(argObj);
|
||||
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(Object.isFrozen(argObj), 'Object.isFrozen(argObj) !== true');
|
||||
|
|
|
@ -4,14 +4,9 @@
|
|||
/*---
|
||||
es5id: 15.2.3.9-3-1
|
||||
description: Object.freeze - returned object is not extensible
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var obj = {};
|
||||
Object.freeze(obj);
|
||||
return !Object.isExtensible(obj);
|
||||
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(Object.isExtensible(obj), false, 'Object.isExtensible(obj)');
|
||||
|
|
|
@ -4,11 +4,8 @@
|
|||
/*---
|
||||
es5id: 15.2.3.9-4-1
|
||||
description: Object.freeze - 'O' is sealed already
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var obj = {};
|
||||
|
||||
obj.foo = 10; // default value of attributes: writable: true, enumerable: true
|
||||
|
@ -16,6 +13,5 @@ function testcase() {
|
|||
Object.seal(obj);
|
||||
|
||||
Object.freeze(obj);
|
||||
return Object.isFrozen(obj);
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(Object.isFrozen(obj), 'Object.isFrozen(obj) !== true');
|
||||
|
|
|
@ -4,11 +4,8 @@
|
|||
/*---
|
||||
es5id: 15.2.3.9-4-2
|
||||
description: Object.freeze - 'O' is frozen already
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var obj = {};
|
||||
|
||||
obj.foo = 10; // default value of attributes: writable: true, enumerable: true
|
||||
|
@ -16,7 +13,5 @@ function testcase() {
|
|||
Object.freeze(obj);
|
||||
|
||||
Object.freeze(obj);
|
||||
return Object.isFrozen(obj);
|
||||
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(Object.isFrozen(obj), 'Object.isFrozen(obj) !== true');
|
||||
|
|
|
@ -4,11 +4,8 @@
|
|||
/*---
|
||||
es5id: 15.2.3.9-4-3
|
||||
description: Object.freeze - the extensions of 'O' is prevented already
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var obj = {};
|
||||
|
||||
obj.foo = 10; // default value of attributes: writable: true, enumerable: true
|
||||
|
@ -16,6 +13,5 @@ function testcase() {
|
|||
Object.preventExtensions(obj);
|
||||
|
||||
Object.freeze(obj);
|
||||
return Object.isFrozen(obj);
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(Object.isFrozen(obj), 'Object.isFrozen(obj) !== true');
|
||||
|
|
|
@ -4,13 +4,8 @@
|
|||
/*---
|
||||
es5id: 15.2.3.10-0-1
|
||||
description: Object.preventExtensions must exist as a function
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var f = Object.preventExtensions;
|
||||
if (typeof(f) === "function") {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(typeof(f), "function", 'typeof(f)');
|
||||
|
|
|
@ -6,12 +6,6 @@ es5id: 15.2.3.10-0-2
|
|||
description: >
|
||||
Object.preventExtensions must exist as a function taking 1
|
||||
parameter
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
if (Object.preventExtensions.length === 1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(Object.preventExtensions.length, 1, 'Object.preventExtensions.length');
|
||||
|
|
|
@ -6,11 +6,6 @@ es5id: 15.2.3.10-1-1
|
|||
description: >
|
||||
Object.preventExtensions does not throw TypeError if 'O' is
|
||||
undefined
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
Object.preventExtensions(undefined);
|
||||
return true;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
|
|
@ -4,11 +4,6 @@
|
|||
/*---
|
||||
es5id: 15.2.3.10-1-2
|
||||
description: Object.preventExtensions does not throw TypeError if 'O' is null
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
Object.preventExtensions(null);
|
||||
return true;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
|
|
@ -6,11 +6,6 @@ es5id: 15.2.3.10-1-3
|
|||
description: >
|
||||
Object.preventExtensions does not throw TypeError if 'O' is a
|
||||
boolean primitive value
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
Object.preventExtensions(true);
|
||||
return true;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
|
|
@ -6,11 +6,6 @@ es5id: 15.2.3.10-1-4
|
|||
description: >
|
||||
Object.preventExtensions does not throw TypeError if 'O' is a
|
||||
string primitive value
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
Object.preventExtensions("abc");
|
||||
return true;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
|
|
@ -6,11 +6,6 @@ es5id: 15.2.3.10-1
|
|||
description: >
|
||||
Object.preventExtensions does not throw TypeError if type of first
|
||||
param is not Object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
Object.preventExtensions(0);
|
||||
return true;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
|
|
@ -6,10 +6,8 @@ es5id: 15.2.3.10-2-1
|
|||
description: >
|
||||
Object.preventExtensions - repeated calls to preventExtensions
|
||||
have no side effects
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var obj = {};
|
||||
var testResult1 = true;
|
||||
var testResult2 = true;
|
||||
|
@ -21,7 +19,6 @@ function testcase() {
|
|||
Object.preventExtensions(obj);
|
||||
testResult2 = Object.isExtensible(obj);
|
||||
|
||||
return preCheck && !testResult1 && !testResult2;
|
||||
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(preCheck, 'preCheck !== true');
|
||||
assert.sameValue(testResult1, false, 'testResult1');
|
||||
assert.sameValue(testResult2, false, 'testResult2');
|
||||
|
|
|
@ -7,16 +7,12 @@ es5id: 15.2.3.10-2
|
|||
description: >
|
||||
Object.preventExtensions returns its arguments after setting its
|
||||
extensible property to false
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var o = {};
|
||||
var o2 = undefined;
|
||||
|
||||
o2 = Object.preventExtensions(o);
|
||||
if (o2 === o && Object.isExtensible(o2) === false) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(o2, o, 'o2');
|
||||
assert.sameValue(Object.isExtensible(o2), false, 'Object.isExtensible(o2)');
|
||||
|
|
|
@ -6,14 +6,11 @@ es5id: 15.2.3.10-3-1
|
|||
description: >
|
||||
Object.preventExtensions - Object.isExtensible(arg) returns false
|
||||
if arg is the returned object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var obj = {};
|
||||
var preCheck = Object.isExtensible(obj);
|
||||
Object.preventExtensions(obj);
|
||||
|
||||
return preCheck && !Object.isExtensible(obj);
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(preCheck, 'preCheck !== true');
|
||||
assert.sameValue(Object.isExtensible(obj), false, 'Object.isExtensible(obj)');
|
||||
|
|
|
@ -6,17 +6,13 @@ es5id: 15.2.3.10-3-22
|
|||
description: >
|
||||
Object.preventExtensions - properties can still be deleted after
|
||||
extensions have been prevented
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var obj = { prop: 12 };
|
||||
var preCheck = Object.isExtensible(obj);
|
||||
Object.preventExtensions(obj);
|
||||
|
||||
delete obj.prop;
|
||||
|
||||
return preCheck && !obj.hasOwnProperty("prop");
|
||||
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(preCheck, 'preCheck !== true');
|
||||
assert.sameValue(obj.hasOwnProperty("prop"), false, 'obj.hasOwnProperty("prop")');
|
||||
|
|
|
@ -6,16 +6,13 @@ es5id: 15.2.3.10-3-23
|
|||
description: >
|
||||
Object.preventExtensions - properties can still be reassigned
|
||||
after extensions have been prevented
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var obj = { prop: 12 };
|
||||
var preCheck = Object.isExtensible(obj);
|
||||
Object.preventExtensions(obj);
|
||||
|
||||
obj.prop = -1;
|
||||
|
||||
return preCheck && obj.prop === -1;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(preCheck, 'preCheck !== true');
|
||||
assert.sameValue(obj.prop, -1, 'obj.prop');
|
||||
|
|
|
@ -7,10 +7,8 @@ description: >
|
|||
Object.preventExtensions - [[Extensible]]: false on a prototype
|
||||
doesn't prevent adding properties to an instance that inherits
|
||||
from that prototype
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var proto = {};
|
||||
var preCheck = Object.isExtensible(proto);
|
||||
Object.preventExtensions(proto);
|
||||
|
@ -21,6 +19,5 @@ function testcase() {
|
|||
|
||||
child.prop = 10;
|
||||
|
||||
return preCheck && child.hasOwnProperty("prop");
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(preCheck, 'preCheck !== true');
|
||||
assert(child.hasOwnProperty("prop"), 'child.hasOwnProperty("prop") !== true');
|
||||
|
|
|
@ -4,13 +4,8 @@
|
|||
/*---
|
||||
es5id: 15.2.3.8-0-1
|
||||
description: Object.seal must exist as a function
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var f = Object.seal;
|
||||
if (typeof(f) === "function") {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(typeof(f), "function", 'typeof(f)');
|
||||
|
|
|
@ -4,12 +4,6 @@
|
|||
/*---
|
||||
es5id: 15.2.3.8-0-2
|
||||
description: Object.seal must exist as a function taking 1 parameter
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
if (Object.seal.length === 1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(Object.seal.length, 1, 'Object.seal.length');
|
||||
|
|
|
@ -6,11 +6,6 @@ es5id: 15.2.3.8-1-1
|
|||
description: >
|
||||
Object.seal does not throw TypeError if type of first param is
|
||||
undefined
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
Object.seal(undefined);
|
||||
return true;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
|
|
@ -4,11 +4,6 @@
|
|||
/*---
|
||||
es5id: 15.2.3.8-1-2
|
||||
description: Object.seal does not throw TypeError if type of first param is null
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
Object.seal(null);
|
||||
return true;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
|
|
@ -6,11 +6,6 @@ es5id: 15.2.3.8-1-3
|
|||
description: >
|
||||
Object.seal does not throw TypeError if type of first param is a
|
||||
boolean primitive
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
Object.seal(false);
|
||||
return true;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
|
|
@ -6,11 +6,6 @@ es5id: 15.2.3.8-1-4
|
|||
description: >
|
||||
Object.seal does not throw TypeError if type of first param is a
|
||||
string primitive
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
Object.seal("abc");
|
||||
return true;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
|
|
@ -6,11 +6,6 @@ es5id: 15.2.3.8-1
|
|||
description: >
|
||||
Object.seal does not throw TypeError if type of first param is not
|
||||
Object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
Object.seal(0);
|
||||
return true;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
|
|
@ -6,16 +6,13 @@ es5id: 15.2.3.8-2-1
|
|||
description: >
|
||||
Object.seal - extensible of 'O' is set as false even if 'O' has no
|
||||
own property
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var obj = {};
|
||||
|
||||
var preCheck = Object.isExtensible(obj);
|
||||
|
||||
Object.seal(obj);
|
||||
|
||||
return preCheck && !Object.isExtensible(obj);
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(preCheck, 'preCheck !== true');
|
||||
assert.sameValue(Object.isExtensible(obj), false, 'Object.isExtensible(obj)');
|
||||
|
|
|
@ -4,10 +4,8 @@
|
|||
/*---
|
||||
es5id: 15.2.3.8-2-2
|
||||
description: Object.seal - inherited data properties are ignored
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var proto = {};
|
||||
|
||||
Object.defineProperty(proto, "Father", {
|
||||
|
@ -26,6 +24,6 @@ function testcase() {
|
|||
delete proto.Father;
|
||||
var afterDeleted = proto.hasOwnProperty("Father");
|
||||
|
||||
return preCheck && beforeDeleted && !afterDeleted;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(preCheck, 'preCheck !== true');
|
||||
assert(beforeDeleted, 'beforeDeleted !== true');
|
||||
assert.sameValue(afterDeleted, false, 'afterDeleted');
|
||||
|
|
|
@ -4,10 +4,8 @@
|
|||
/*---
|
||||
es5id: 15.2.3.8-2-3
|
||||
description: Object.seal - inherited accessor properties are ignored
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var proto = {};
|
||||
|
||||
Object.defineProperty(proto, "Father", {
|
||||
|
@ -28,6 +26,6 @@ function testcase() {
|
|||
delete proto.Father;
|
||||
var afterDeleted = proto.hasOwnProperty("Father");
|
||||
|
||||
return preCheck && beforeDeleted && !afterDeleted;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(preCheck, 'preCheck !== true');
|
||||
assert(beforeDeleted, 'beforeDeleted !== true');
|
||||
assert.sameValue(afterDeleted, false, 'afterDeleted');
|
||||
|
|
|
@ -4,16 +4,11 @@
|
|||
/*---
|
||||
es5id: 15.2.3.8-2-c-1
|
||||
description: Object.seal - 'O' is a Function object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var fun = function () { };
|
||||
var preCheck = Object.isExtensible(fun);
|
||||
Object.seal(fun);
|
||||
|
||||
return preCheck && Object.isSealed(fun);
|
||||
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(preCheck, 'preCheck !== true');
|
||||
assert(Object.isSealed(fun), 'Object.isSealed(fun) !== true');
|
||||
|
|
|
@ -4,16 +4,11 @@
|
|||
/*---
|
||||
es5id: 15.2.3.8-2-c-2
|
||||
description: Object.seal - 'O' is an Array object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var arr = [0, 1];
|
||||
var preCheck = Object.isExtensible(arr);
|
||||
Object.seal(arr);
|
||||
|
||||
return preCheck && Object.isSealed(arr);
|
||||
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(preCheck, 'preCheck !== true');
|
||||
assert(Object.isSealed(arr), 'Object.isSealed(arr) !== true');
|
||||
|
|
|
@ -4,16 +4,11 @@
|
|||
/*---
|
||||
es5id: 15.2.3.8-2-c-3
|
||||
description: Object.seal - 'O' is a String object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var strObj = new String("a");
|
||||
var preCheck = Object.isExtensible(strObj);
|
||||
Object.seal(strObj);
|
||||
|
||||
return preCheck && Object.isSealed(strObj);
|
||||
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(preCheck, 'preCheck !== true');
|
||||
assert(Object.isSealed(strObj), 'Object.isSealed(strObj) !== true');
|
||||
|
|
|
@ -4,16 +4,11 @@
|
|||
/*---
|
||||
es5id: 15.2.3.8-2-c-4
|
||||
description: Object.seal - 'O' is a Boolean object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var boolObj = new Boolean(false);
|
||||
var preCheck = Object.isExtensible(boolObj);
|
||||
Object.seal(boolObj);
|
||||
|
||||
return preCheck && Object.isSealed(boolObj);
|
||||
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(preCheck, 'preCheck !== true');
|
||||
assert(Object.isSealed(boolObj), 'Object.isSealed(boolObj) !== true');
|
||||
|
|
|
@ -4,16 +4,11 @@
|
|||
/*---
|
||||
es5id: 15.2.3.8-2-c-5
|
||||
description: Object.seal - 'O' is a Number object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var numObj = new Number(3);
|
||||
var preCheck = Object.isExtensible(numObj);
|
||||
Object.seal(numObj);
|
||||
|
||||
return preCheck && Object.isSealed(numObj);
|
||||
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(preCheck, 'preCheck !== true');
|
||||
assert(Object.isSealed(numObj), 'Object.isSealed(numObj) !== true');
|
||||
|
|
|
@ -4,15 +4,11 @@
|
|||
/*---
|
||||
es5id: 15.2.3.8-2-c-6
|
||||
description: Object.seal - 'O' is a Date object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var dateObj = new Date();
|
||||
var preCheck = Object.isExtensible(dateObj);
|
||||
Object.seal(dateObj);
|
||||
|
||||
return preCheck && Object.isSealed(dateObj);
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(preCheck, 'preCheck !== true');
|
||||
assert(Object.isSealed(dateObj), 'Object.isSealed(dateObj) !== true');
|
||||
|
|
|
@ -4,14 +4,11 @@
|
|||
/*---
|
||||
es5id: 15.2.3.8-2-c-7
|
||||
description: Object.seal - 'O' is a RegExp object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var regObj = new RegExp();
|
||||
var preCheck = Object.isExtensible(regObj);
|
||||
Object.seal(regObj);
|
||||
|
||||
return preCheck && Object.isSealed(regObj);
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(preCheck, 'preCheck !== true');
|
||||
assert(Object.isSealed(regObj), 'Object.isSealed(regObj) !== true');
|
||||
|
|
|
@ -4,16 +4,11 @@
|
|||
/*---
|
||||
es5id: 15.2.3.8-2-c-8
|
||||
description: Object.seal - 'O' is an Error object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var errObj = new Error();
|
||||
var preCheck = Object.isExtensible(errObj);
|
||||
Object.seal(errObj);
|
||||
|
||||
return preCheck && Object.isSealed(errObj);
|
||||
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(preCheck, 'preCheck !== true');
|
||||
assert(Object.isSealed(errObj), 'Object.isSealed(errObj) !== true');
|
||||
|
|
|
@ -4,17 +4,12 @@
|
|||
/*---
|
||||
es5id: 15.2.3.8-2-c-9
|
||||
description: Object.seal - 'O' is an Arguments object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var argObj = (function () { return arguments; })();
|
||||
|
||||
var preCheck = Object.isExtensible(argObj);
|
||||
Object.seal(argObj);
|
||||
|
||||
return preCheck && Object.isSealed(argObj);
|
||||
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(preCheck, 'preCheck !== true');
|
||||
assert(Object.isSealed(argObj), 'Object.isSealed(argObj) !== true');
|
||||
|
|
|
@ -4,15 +4,11 @@
|
|||
/*---
|
||||
es5id: 15.2.3.8-3-1
|
||||
description: Object.seal - returned object is not extensible
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var obj = {};
|
||||
var preCheck = Object.isExtensible(obj);
|
||||
Object.seal(obj);
|
||||
return preCheck && !Object.isExtensible(obj);
|
||||
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(preCheck, 'preCheck !== true');
|
||||
assert.sameValue(Object.isExtensible(obj), false, 'Object.isExtensible(obj)');
|
||||
|
|
|
@ -4,11 +4,8 @@
|
|||
/*---
|
||||
es5id: 15.2.3.8-4-1
|
||||
description: Object.seal - 'O' is sealed already
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var obj = {};
|
||||
|
||||
obj.foo = 10; // default value of attributes: writable: true, configurable: true, enumerable: true
|
||||
|
@ -16,7 +13,6 @@ function testcase() {
|
|||
Object.seal(obj);
|
||||
|
||||
Object.seal(obj);
|
||||
return preCheck && Object.isSealed(obj);
|
||||
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(preCheck, 'preCheck !== true');
|
||||
assert(Object.isSealed(obj), 'Object.isSealed(obj) !== true');
|
||||
|
|
|
@ -4,11 +4,8 @@
|
|||
/*---
|
||||
es5id: 15.2.3.8-4-2
|
||||
description: Object.seal - 'O' is frozen already
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var obj = {};
|
||||
|
||||
obj.foo = 10; // default value of attributes: writable: true, configurable: true, enumerable: true
|
||||
|
@ -16,6 +13,6 @@ function testcase() {
|
|||
Object.freeze(obj);
|
||||
|
||||
Object.seal(obj);
|
||||
return preCheck && Object.isSealed(obj);
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(preCheck, 'preCheck !== true');
|
||||
assert(Object.isSealed(obj), 'Object.isSealed(obj) !== true');
|
||||
|
|
|
@ -4,17 +4,14 @@
|
|||
/*---
|
||||
es5id: 15.2.3.8-4-3
|
||||
description: Object.seal - the extension of 'O' is prevented already
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var obj = {};
|
||||
|
||||
obj.foo = 10; // default value of attributes: writable: true, configurable: true, enumerable: true
|
||||
var preCheck = Object.isExtensible(obj);
|
||||
Object.preventExtensions(obj);
|
||||
Object.seal(obj);
|
||||
return preCheck && Object.isSealed(obj);
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(preCheck, 'preCheck !== true');
|
||||
assert(Object.isSealed(obj), 'Object.isSealed(obj) !== true');
|
||||
|
|
Loading…
Reference in New Issue