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