Transform legacy format to harness assertions: test/built-ins/O*/**/*.js

This commit is contained in:
rwaldron 2021-08-12 16:28:19 -04:00 committed by Leo Balter
parent 2a385983b1
commit 19d081ef1d
114 changed files with 903 additions and 1439 deletions
test/built-ins/Object
S15.2.1.1_A1_T1.jsS15.2.1.1_A1_T2.jsS15.2.1.1_A1_T3.jsS15.2.1.1_A1_T4.jsS15.2.1.1_A1_T5.jsS15.2.1.1_A2_T1.jsS15.2.1.1_A2_T10.jsS15.2.1.1_A2_T11.jsS15.2.1.1_A2_T12.jsS15.2.1.1_A2_T13.jsS15.2.1.1_A2_T14.jsS15.2.1.1_A2_T2.jsS15.2.1.1_A2_T3.jsS15.2.1.1_A2_T4.jsS15.2.1.1_A2_T5.jsS15.2.1.1_A2_T6.jsS15.2.1.1_A2_T7.jsS15.2.1.1_A2_T8.jsS15.2.1.1_A2_T9.jsS15.2.1.1_A3_T1.jsS15.2.1.1_A3_T2.jsS15.2.1.1_A3_T3.jsS15.2.2.1_A1_T1.jsS15.2.2.1_A1_T2.jsS15.2.2.1_A1_T3.jsS15.2.2.1_A1_T4.jsS15.2.2.1_A1_T5.jsS15.2.2.1_A2_T1.jsS15.2.2.1_A2_T2.jsS15.2.2.1_A2_T3.jsS15.2.2.1_A2_T5.jsS15.2.2.1_A2_T6.jsS15.2.2.1_A2_T7.jsS15.2.2.1_A3_T1.jsS15.2.2.1_A3_T2.jsS15.2.2.1_A3_T3.jsS15.2.2.1_A4_T1.jsS15.2.2.1_A4_T2.jsS15.2.2.1_A4_T3.jsS15.2.2.1_A5_T1.jsS15.2.2.1_A5_T2.jsS15.2.2.1_A5_T3.jsS15.2.2.1_A5_T4.jsS15.2.2.1_A6_T1.jsS15.2.2.1_A6_T2.jsS15.2.2.1_A6_T3.jsS15.2.3_A1.jsS15.2.3_A2.jsS15.2.3_A3.jsS15.2_A1.jsS9.9_A3.jsS9.9_A4.jsS9.9_A5.jsS9.9_A6.js
assign
defineProperty
getOwnPropertyNames
prototype

View File

@ -13,22 +13,28 @@ var __obj = Object(null);
var n__obj = new Object(null);
if (__obj.toString() !== n__obj.toString()) {
throw new Test262Error('#1');
}
assert.sameValue(
__obj.toString(),
n__obj.toString(),
'__obj.toString() must return the same value returned by n__obj.toString()'
);
if (__obj.constructor !== n__obj.constructor) {
throw new Test262Error('#2');
}
assert.sameValue(
__obj.constructor,
n__obj.constructor,
'The value of __obj.constructor is expected to equal the value of n__obj.constructor'
);
if (__obj.prototype !== n__obj.prototype) {
throw new Test262Error('#3');
}
assert.sameValue(
__obj.prototype,
n__obj.prototype,
'The value of __obj.prototype is expected to equal the value of n__obj.prototype'
);
if (__obj.toLocaleString() !== n__obj.toLocaleString()) {
throw new Test262Error('#4');
}
assert.sameValue(
__obj.toLocaleString(),
n__obj.toLocaleString(),
'__obj.toLocaleString() must return the same value returned by n__obj.toLocaleString()'
);
if (typeof __obj !== typeof n__obj) {
throw new Test262Error('#5');
}
assert.sameValue(typeof __obj, typeof n__obj, 'The value of `typeof __obj` is expected to be typeof n__obj');

View File

@ -16,22 +16,28 @@ var __obj = Object(void 0);
var n__obj = new Object(void 0);
if (__obj.toString() !== n__obj.toString()) {
throw new Test262Error('#1');
}
assert.sameValue(
__obj.toString(),
n__obj.toString(),
'__obj.toString() must return the same value returned by n__obj.toString()'
);
if (__obj.constructor !== n__obj.constructor) {
throw new Test262Error('#2');
}
assert.sameValue(
__obj.constructor,
n__obj.constructor,
'The value of __obj.constructor is expected to equal the value of n__obj.constructor'
);
if (__obj.prototype !== n__obj.prototype) {
throw new Test262Error('#3');
}
assert.sameValue(
__obj.prototype,
n__obj.prototype,
'The value of __obj.prototype is expected to equal the value of n__obj.prototype'
);
if (__obj.toLocaleString() !== n__obj.toLocaleString()) {
throw new Test262Error('#4');
}
assert.sameValue(
__obj.toLocaleString(),
n__obj.toLocaleString(),
'__obj.toLocaleString() must return the same value returned by n__obj.toLocaleString()'
);
if (typeof __obj !== typeof n__obj) {
throw new Test262Error('#5');
}
assert.sameValue(typeof __obj, typeof n__obj, 'The value of `typeof __obj` is expected to be typeof n__obj');

View File

@ -13,22 +13,28 @@ var __obj = Object();
var n__obj = new Object();
if (__obj.toString() !== n__obj.toString()) {
throw new Test262Error('#1');
}
assert.sameValue(
__obj.toString(),
n__obj.toString(),
'__obj.toString() must return the same value returned by n__obj.toString()'
);
if (__obj.constructor !== n__obj.constructor) {
throw new Test262Error('#2');
}
assert.sameValue(
__obj.constructor,
n__obj.constructor,
'The value of __obj.constructor is expected to equal the value of n__obj.constructor'
);
if (__obj.prototype !== n__obj.prototype) {
throw new Test262Error('#3');
}
assert.sameValue(
__obj.prototype,
n__obj.prototype,
'The value of __obj.prototype is expected to equal the value of n__obj.prototype'
);
if (__obj.toLocaleString() !== n__obj.toLocaleString()) {
throw new Test262Error('#4');
}
assert.sameValue(
__obj.toLocaleString(),
n__obj.toLocaleString(),
'__obj.toLocaleString() must return the same value returned by n__obj.toLocaleString()'
);
if (typeof __obj !== typeof n__obj) {
throw new Test262Error('#5');
}
assert.sameValue(typeof __obj, typeof n__obj, 'The value of `typeof __obj` is expected to be typeof n__obj');

View File

@ -13,22 +13,28 @@ var __obj = Object(undefined);
var n__obj = new Object(undefined);
if (__obj.toString() !== n__obj.toString()) {
throw new Test262Error('#1');
}
assert.sameValue(
__obj.toString(),
n__obj.toString(),
'__obj.toString() must return the same value returned by n__obj.toString()'
);
if (__obj.constructor !== n__obj.constructor) {
throw new Test262Error('#2');
}
assert.sameValue(
__obj.constructor,
n__obj.constructor,
'The value of __obj.constructor is expected to equal the value of n__obj.constructor'
);
if (__obj.prototype !== n__obj.prototype) {
throw new Test262Error('#3');
}
assert.sameValue(
__obj.prototype,
n__obj.prototype,
'The value of __obj.prototype is expected to equal the value of n__obj.prototype'
);
if (__obj.toLocaleString() !== n__obj.toLocaleString()) {
throw new Test262Error('#4');
}
assert.sameValue(
__obj.toLocaleString(),
n__obj.toLocaleString(),
'__obj.toLocaleString() must return the same value returned by n__obj.toLocaleString()'
);
if (typeof __obj !== typeof n__obj) {
throw new Test262Error('#5');
}
assert.sameValue(typeof __obj, typeof n__obj, 'The value of `typeof __obj` is expected to be typeof n__obj');

View File

@ -13,24 +13,30 @@ var __obj = Object(x);
var n__obj = new Object(x);
if (__obj.toString() !== n__obj.toString()) {
throw new Test262Error('#1');
}
assert.sameValue(
__obj.toString(),
n__obj.toString(),
'__obj.toString() must return the same value returned by n__obj.toString()'
);
if (__obj.constructor !== n__obj.constructor) {
throw new Test262Error('#2');
}
assert.sameValue(
__obj.constructor,
n__obj.constructor,
'The value of __obj.constructor is expected to equal the value of n__obj.constructor'
);
if (__obj.prototype !== n__obj.prototype) {
throw new Test262Error('#3');
}
assert.sameValue(
__obj.prototype,
n__obj.prototype,
'The value of __obj.prototype is expected to equal the value of n__obj.prototype'
);
if (__obj.toLocaleString() !== n__obj.toLocaleString()) {
throw new Test262Error('#4');
}
assert.sameValue(
__obj.toLocaleString(),
n__obj.toLocaleString(),
'__obj.toLocaleString() must return the same value returned by n__obj.toLocaleString()'
);
if (typeof __obj !== typeof n__obj) {
throw new Test262Error('#5');
}
assert.sameValue(typeof __obj, typeof n__obj, 'The value of `typeof __obj` is expected to be typeof n__obj');
var x;

View File

@ -11,24 +11,11 @@ description: Calling Object function with boolean argument value
var bool = true;
if (typeof bool !== 'boolean') {
throw new Test262Error('#1: bool should be boolean primitive');
}
assert.sameValue(typeof bool, 'boolean', 'The value of `typeof bool` is expected to be "boolean"');
var obj = Object(bool);
if (obj.constructor !== Boolean) {
throw new Test262Error('#2: Object(true) returns ToObject(true)');
}
if (typeof obj !== "object") {
throw new Test262Error('#3: Object(true) returns ToObject(true)');
}
if (!obj) {
throw new Test262Error('#4: Object(true) returns ToObject(true)');
}
if (obj === true) {
throw new Test262Error('#5: Object(true) returns ToObject(true)');
}
assert.sameValue(obj.constructor, Boolean, 'The value of obj.constructor is expected to equal the value of Boolean');
assert.sameValue(typeof obj, "object", 'The value of `typeof obj` is expected to be "object"');
assert(!!obj, 'The value of !!obj is expected to be true');
assert.notSameValue(obj, true, 'The value of obj is not true');

View File

@ -11,16 +11,11 @@ description: Calling Object function with array of numbers as argument value
var arr = [1, 2, 3];
//CHECK#1
if (typeof arr !== 'object') {
throw new Test262Error('#1: arr = [1,2,3] is NOT an object');
}
assert.sameValue(typeof arr, 'object', 'The value of `typeof arr` is expected to be "object"');
var n_obj = Object(arr);
arr.push(4);
//CHECK#2
if ((n_obj !== arr) || (n_obj[3] !== 4)) {
throw new Test262Error('#2: Object([1,2,3]) returns ToObject([1,2,3])');
}
assert.sameValue(n_obj, arr, 'The value of n_obj is expected to equal the value of arr');
assert.sameValue(n_obj[3], 4, 'The value of n_obj[3] is expected to be 4');

View File

@ -8,22 +8,17 @@ info: |
es5id: 15.2.1.1_A2_T11
description: Calling Object function with function declaration as argument value
---*/
//CHECK#1
if (typeof func !== 'undefined') {
throw new Test262Error('#1: function expression can\'t be declarated');
}
assert.sameValue(typeof func, 'undefined', 'The value of `typeof func` is expected to be "undefined"');
var n_obj = Object(function func() {
return 1;
});
//CHECK#2
if ((n_obj.constructor !== Function) || (n_obj() !== 1)) {
throw new Test262Error('#2: Object(function func(){return 1;}) returns function');
}
assert.sameValue(
n_obj.constructor,
Function,
'The value of n_obj.constructor is expected to equal the value of Function'
);
assert.sameValue(n_obj(), 1, 'n_obj() must return 1')
assert.sameValue(typeof func, 'undefined', 'The value of `typeof func` is expected to be "undefined"');
//CHECK#3
if (typeof func !== 'undefined') {
throw new Test262Error('#3: function expression can\'t be declarated');
}

View File

@ -13,18 +13,7 @@ var obj = Object(1.1 * ([].length + {
q: 1
}["q"]));
//CHECK#2
if (typeof obj !== "object") {
throw new Test262Error('#2: Object(expression) returns ToObject(expression)');
}
//CHECK#3
if (obj.constructor !== Number) {
throw new Test262Error('#3: Object(expression) returns ToObject(expression)');
}
//CHECK#4
if ((obj != 1.1) || (obj === 1.1)) {
throw new Test262Error('#4: Object(expression) returns ToObject(expression)');
}
//
assert.sameValue(typeof obj, "object", 'The value of `typeof obj` is expected to be "object"');
assert.sameValue(obj.constructor, Number, 'The value of obj.constructor is expected to equal the value of Number');
assert(obj == 1.1, 'The result of evaluating (obj == 1.1) is expected to be true');
assert.notSameValue(obj, 1.1, 'The value of obj is not 1.1');

View File

@ -11,22 +11,7 @@ description: Calling Object function with boolean expression as argument value
var obj = Object((1 === 1) && (!false));
//CHECK#1
if (obj.constructor !== Boolean) {
throw new Test262Error('#1: Object(expression) returns ToObject(expression)');
}
//CHECK#1.1
if (typeof obj !== "object") {
throw new Test262Error('#1.1: Object(expression) returns ToObject(expression)');
}
//CHECK#2
if (!(obj)) {
throw new Test262Error('#2: Object(expression) returns ToObject(expression)');
}
//CHECK#3
if (obj === true) {
throw new Test262Error('#3: Object(expression) returns ToObject(expression)');
}
assert.sameValue(obj.constructor, Boolean, 'The value of obj.constructor is expected to equal the value of Boolean');
assert.sameValue(typeof obj, "object", 'The value of `typeof obj` is expected to be "object"');
assert(!!obj, 'The value of !!obj is expected to be true');
assert.notSameValue(obj, true, 'The value of obj is not true');

View File

@ -13,17 +13,7 @@ description: >
var obj = Object("" + 1);
//CHECK#2
if (obj.constructor !== String) {
throw new Test262Error('#2: Object(expression) returns ToObject(expression)');
}
//CHECK#3
if (typeof obj !== "object") {
throw new Test262Error('#3: Object(expression) returns ToObject(expression)');
}
//CHECK#4
if ((obj != "1") || (obj === "1")) {
throw new Test262Error('#4: Object(expression) returns ToObject(expression)');
}
assert.sameValue(obj.constructor, String, 'The value of obj.constructor is expected to equal the value of String');
assert.sameValue(typeof obj, "object", 'The value of `typeof obj` is expected to be "object"');
assert(obj == "1", 'The result of evaluating (obj == "1") is expected to be true');
assert.notSameValue(obj, "1", 'The value of obj is not "1"');

View File

@ -11,25 +11,12 @@ description: Calling Object function with number argument value
var num = 1.1;
// CHECK#1
if (typeof num !== 'number') {
throw new Test262Error('#1: num = 1.1 should be Number primitive');
}
assert.sameValue(typeof num, 'number', 'The value of `typeof num` is expected to be "number"');
var obj = Object(num);
//CHECK#2
if (typeof obj !== "object") {
throw new Test262Error('#2: Object(1.1) returns ToObject(1.1)');
}
assert.sameValue(typeof obj, "object", 'The value of `typeof obj` is expected to be "object"');
assert.sameValue(obj.constructor, Number, 'The value of obj.constructor is expected to equal the value of Number');
//CHECK#3
if (obj.constructor !== Number) {
throw new Test262Error('#3: Object(1.1) returns ToObject(1.1)');
}
//CHECK#4
if ((obj != 1.1) || (obj === 1.1)) {
throw new Test262Error('#4: Object(1.1) returns ToObject(1.1)');
}
//
assert(obj == 1.1, 'The result of evaluating (obj == 1.1) is expected to be true');
assert.notSameValue(obj, 1.1, 'The value of obj is not 1.1');

View File

@ -11,24 +11,11 @@ description: Calling Object function with string argument value
var str = 'Luke Skywalker';
// CHECK#1
if (typeof str !== 'string') {
throw new Test262Error('#1: "Luke Skywalker" should be a String primitive');
}
assert.sameValue(typeof str, 'string', 'The value of `typeof str` is expected to be "string"');
var obj = Object(str);
//CHECK#2
if (obj.constructor !== String) {
throw new Test262Error('#2: Object("Luke Skywalker") returns ToObject("Luke Skywalker")');
}
//CHECK#3
if (typeof obj !== "object") {
throw new Test262Error('#3: Object("Luke Skywalker") returns ToObject("Luke Skywalker")');
}
//CHECK#4
if ((obj != "Luke Skywalker") || (obj === "Luke Skywalker")) {
throw new Test262Error('#4: Object("Luke Skywalker") returns ToObject("Luke Skywalker")');
}
assert.sameValue(obj.constructor, String, 'The value of obj.constructor is expected to equal the value of String');
assert.sameValue(typeof obj, "object", 'The value of `typeof obj` is expected to be "object"');
assert(obj == "Luke Skywalker", 'The result of evaluating (obj == "Luke Skywalker") is expected to be true');
assert.notSameValue(obj, "Luke Skywalker", 'The value of obj is not "Luke Skywalker"');

View File

@ -13,14 +13,9 @@ var obj = {
flag: true
};
//CHECK#1
if (typeof(obj) !== 'object') {
throw new Test262Error('#1: obj = {flag:true} should be an Object');
}
assert.sameValue(typeof(obj), 'object', 'The value of `typeof(obj)` is expected to be "object"');
var n_obj = Object(obj);
//CHECK#2
if ((n_obj !== obj) || (!(n_obj['flag']))) {
throw new Test262Error('#2: Object({flag:true}) returns ToObject({flag:true})');
}
assert.sameValue(n_obj, obj, 'The value of n_obj is expected to equal the value of obj');
assert(!!n_obj['flag'], 'The value of !!n_obj["flag"] is expected to be true');

View File

@ -11,20 +11,9 @@ description: Calling Object function with NaN argument value
var num = NaN;
// CHECK#1
if (typeof num !== 'number') {
throw new Test262Error('#1: num = NaN should have number type');
}
assert.sameValue(typeof num, 'number', 'The value of `typeof num` is expected to be "number"');
var obj = Object(num);
//CHECK#2
if (obj.constructor !== Number) {
throw new Test262Error('#2: Object(NaN) returns ToObject(NaN)');
}
//CHECK#3
if (typeof obj !== "object") {
throw new Test262Error('#2: Object(NaN) returns ToObject(NaN)');
}
//
assert.sameValue(obj.constructor, Number, 'The value of obj.constructor is expected to equal the value of Number');
assert.sameValue(typeof obj, "object", 'The value of `typeof obj` is expected to be "object"');

View File

@ -11,24 +11,11 @@ description: Calling Object function with Infinity argument value
var num = Infinity;
// CHECK#1
if (typeof num !== 'number') {
throw new Test262Error('#1: num = Infinity should be a Number primitive');
}
assert.sameValue(typeof num, 'number', 'The value of `typeof num` is expected to be "number"');
var obj = Object(num);
//CHECK#2
if (obj.constructor !== Number) {
throw new Test262Error('#2: Object(Infinity) returns ToObject(Infinity)');
}
//CHECK#3
if (typeof obj !== "object") {
throw new Test262Error('#3: Object(Infinity) returns ToObject(Infinity)');
}
//CHECK#4
if ((obj != Infinity) || (obj === Infinity)) {
throw new Test262Error('#4: Object(Infinity) returns ToObject(Infinity)');
}
assert.sameValue(obj.constructor, Number, 'The value of obj.constructor is expected to equal the value of Number');
assert.sameValue(typeof obj, "object", 'The value of `typeof obj` is expected to be "object"');
assert(obj == Infinity, 'The result of evaluating (obj == Infinity) is expected to be true');
assert.notSameValue(obj, Infinity, 'The value of obj is expected to not equal ``Infinity``');

View File

@ -11,24 +11,11 @@ description: Calling Object function with empty string argument value
var str = '';
// CHECK#1
if (typeof(str) !== 'string') {
throw new Test262Error('#1: "" is NOT a String');
}
assert.sameValue(typeof(str), 'string', 'The value of `typeof(str)` is expected to be "string"');
var obj = Object(str);
//CHECK#2
if (obj.constructor !== String) {
throw new Test262Error('#2: Object("") returns ToObject("")');
}
//CHECK#3
if (typeof obj !== "object") {
throw new Test262Error('#3: Object("") returns ToObject("")');
}
//CHECK#4
if ((obj != "") || (obj === "")) {
throw new Test262Error('#4: Object("") returns ToObject("")');
}
assert.sameValue(obj.constructor, String, 'The value of obj.constructor is expected to equal the value of String');
assert.sameValue(typeof obj, "object", 'The value of `typeof obj` is expected to be "object"');
assert(obj == "", 'The result of evaluating (obj == "") is expected to be true');
assert.notSameValue(obj, "", 'The value of obj is not ""');

View File

@ -13,14 +13,9 @@ var func = function() {
return 1;
};
//CHECK#1
if (typeof func !== 'function') {
throw new Test262Error('#1: func = function(){return 1;} is NOT an function');
}
assert.sameValue(typeof func, 'function', 'The value of `typeof func` is expected to be "function"');
var n_obj = Object(func);
//CHECK#2
if ((n_obj !== func) || (n_obj() !== 1)) {
throw new Test262Error('#2: Object(function) returns function');
}
assert.sameValue(n_obj, func, 'The value of n_obj is expected to equal the value of func');
assert.sameValue(n_obj(), 1, 'n_obj() must return 1');

View File

@ -10,19 +10,13 @@ description: >
Calling Object function with function argument value. The function
is declared
---*/
//CHECK#1
if (typeof func !== 'function') {
throw new Test262Error('#1: func = function(){return 1;} is NOT an function');
function func() {
return 1;
}
assert.sameValue(typeof func, 'function', 'The value of `typeof func` is expected to be "function"');
var n_obj = Object(func);
//CHECK#2
if ((n_obj !== func) || (n_obj() !== 1)) {
throw new Test262Error('#2: Object(function) returns function');
}
function func() {
return 1;
};
assert.sameValue(n_obj, func, 'The value of n_obj is expected to equal the value of func');
assert.sameValue(n_obj(), 1, 'n_obj() must return 1');

View File

@ -11,17 +11,9 @@ description: Creating an object with "Object(1,2,3)"
var obj = Object(1, 2, 3);
//CHECK#1
if (obj.constructor !== Number) {
throw new Test262Error('#1: Since Object as a function calling is the same as function calling list of arguments can appears in braces;');
}
assert.sameValue(obj.constructor, Number, 'The value of obj.constructor is expected to equal the value of Number');
assert.sameValue(typeof obj, "object", 'The value of `typeof obj` is expected to be "object"');
//CHECK#2
if (typeof obj !== "object") {
throw new Test262Error('#2: Since Object as a function calling is the same as function calling list of arguments can appears in braces;');
}
assert(obj == 1, 'The result of evaluating (obj == 1) is expected to be true');
assert.notSameValue(obj, 1, 'The value of obj is not 1');
//CHECK#3
if ((obj != 1) || (obj === 1)) {
throw new Test262Error('3#: Since Object as a function calling is the same as function calling list of arguments can appears in braces;');
}

View File

@ -11,12 +11,5 @@ description: Creating an object with "Object(null,2,3)"
var obj = Object(null, 2, 3);
//CHECK#1
if (obj.constructor !== Object) {
throw new Test262Error('#1: Since Object as a function calling is the same as function calling list of arguments can appears in braces;');
}
//CHECK#2
if (typeof obj !== "object") {
throw new Test262Error('#2: Since Object as a function calling is the same as function calling list of arguments can appears in braces;');
}
assert.sameValue(obj.constructor, Object, 'The value of obj.constructor is expected to equal the value of Object');
assert.sameValue(typeof obj, "object", 'The value of `typeof obj` is expected to be "object"');

View File

@ -11,17 +11,9 @@ description: Creating an object with "Object((null,2,3),1,2)"
var obj = Object((null, 2, 3), 1, 2);
//CHECK#1
if (obj.constructor !== Number) {
throw new Test262Error('#1: Since Object as a function calling is the same as function calling list of arguments can appears in braces;');
}
assert.sameValue(obj.constructor, Number, 'The value of obj.constructor is expected to equal the value of Number');
assert.sameValue(typeof obj, "object", 'The value of `typeof obj` is expected to be "object"');
//CHECK#2
if (typeof obj !== "object") {
throw new Test262Error('#2: Since Object as a function calling is the same as function calling list of arguments can appears in braces;');
}
assert(obj == 3, 'The result of evaluating (obj == 3) is expected to be true');
assert.notSameValue(obj, 3, 'The value of obj is not 3');
//CHECK#3
if ((obj != 3) || (obj === 3)) {
throw new Test262Error('3#: Since Object as a function calling is the same as function calling list of arguments can appears in braces;');
}

View File

@ -16,28 +16,19 @@ description: Creating new Object() and checking its properties
var obj = new Object();
// CHECK#0
if (obj === undefined) {
throw new Test262Error('#0: new Object() return the newly created native object.');
}
assert.notSameValue(obj, undefined, 'The value of obj is expected to not equal ``undefined``');
assert.sameValue(obj.constructor, Object, 'The value of obj.constructor is expected to equal the value of Object');
// CHECK#1
if (obj.constructor !== Object) {
throw new Test262Error('#1: new Object() create a new native ECMAScript object');
}
assert(
!!Object.prototype.isPrototypeOf(obj),
'The value of !!Object.prototype.isPrototypeOf(obj) is expected to be true'
);
// CHECK#2
if (!(Object.prototype.isPrototypeOf(obj))) {
throw new Test262Error('#2: when new Object() calls the [[Prototype]] property of the newly constructed object is set to the Object prototype object.');
}
// CHECK#3
var to_string_result = '[object ' + 'Object' + ']';
if (obj.toString() !== to_string_result) {
throw new Test262Error('#3: when new Object() calls the [[Class]] property of the newly constructed object is set to "Object".');
}
assert.sameValue(obj.toString(), to_string_result, 'obj.toString() returns to_string_result');
// CHECK#4
if (obj.valueOf().toString() !== to_string_result.toString()) {
throw new Test262Error('#4: when new Object() calls the newly constructed object has no [[Value]] property.');
}
assert.sameValue(
obj.valueOf().toString(),
to_string_result.toString(),
'obj.valueOf().toString() must return the same value returned by to_string_result.toString()'
);

View File

@ -17,28 +17,19 @@ description: Creating new Object(void 0) and checking its properties
//var foo = void 0;
var obj = new Object(void 0);
// CHECK#0
if (obj === undefined) {
throw new Test262Error('#0: new Object(undefined) return the newly created native object.');
}
assert.notSameValue(obj, undefined, 'The value of obj is expected to not equal ``undefined``');
assert.sameValue(obj.constructor, Object, 'The value of obj.constructor is expected to equal the value of Object');
// CHECK#1
if (obj.constructor !== Object) {
throw new Test262Error('#1: new Object(undefined) create a new native ECMAScript object');
}
assert(
!!Object.prototype.isPrototypeOf(obj),
'The value of !!Object.prototype.isPrototypeOf(obj) is expected to be true'
);
// CHECK#2
if (!(Object.prototype.isPrototypeOf(obj))) {
throw new Test262Error('#2: when new Object(undefined) calls the [[Prototype]] property of the newly constructed object is set to the Object prototype object.');
}
// CHECK#3
var to_string_result = '[object ' + 'Object' + ']';
if (obj.toString() !== to_string_result) {
throw new Test262Error('#3: when new Object(undefined) calls the [[Class]] property of the newly constructed object is set to "Object".');
}
assert.sameValue(obj.toString(), to_string_result, 'obj.toString() returns to_string_result');
// CHECK#4
if (obj.valueOf().toString() !== to_string_result.toString()) {
throw new Test262Error('#4: when new Object(undefined) calls the newly constructed object has no [[Value]] property.');
}
assert.sameValue(
obj.valueOf().toString(),
to_string_result.toString(),
'obj.valueOf().toString() must return the same value returned by to_string_result.toString()'
);

View File

@ -16,28 +16,19 @@ description: Creating new Object(null) and checking its properties
var obj = new Object(null);
// CHECK#0
if (obj === undefined) {
throw new Test262Error('#0: new Object(null) return the newly created native object.');
}
assert.notSameValue(obj, undefined, 'The value of obj is expected to not equal ``undefined``');
assert.sameValue(obj.constructor, Object, 'The value of obj.constructor is expected to equal the value of Object');
// CHECK#1
if (obj.constructor !== Object) {
throw new Test262Error('#1: new Object(null) create a new native ECMAScript object');
}
assert(
!!Object.prototype.isPrototypeOf(obj),
'The value of !!Object.prototype.isPrototypeOf(obj) is expected to be true'
);
// CHECK#2
if (!(Object.prototype.isPrototypeOf(obj))) {
throw new Test262Error('#2: when new Object(null) calls the [[Prototype]] property of the newly constructed object is set to the Object prototype object.');
}
// CHECK#3
var to_string_result = '[object ' + 'Object' + ']';
if (obj.toString() !== to_string_result) {
throw new Test262Error('#3: when new Object(null) calls the [[Class]] property of the newly constructed object is set to "Object".');
}
assert.sameValue(obj.toString(), to_string_result, 'obj.toString() returns to_string_result');
// CHECK#4
if (obj.valueOf().toString() !== to_string_result.toString()) {
throw new Test262Error('#4: when new Object(null) calls the newly constructed object has no [[Value]] property.');
}
assert.sameValue(
obj.valueOf().toString(),
to_string_result.toString(),
'obj.valueOf().toString() must return the same value returned by to_string_result.toString()'
);

View File

@ -16,28 +16,19 @@ description: Creating new Object(undefined) and checking its properties
var obj = new Object(undefined);
// CHECK#0
if (obj === undefined) {
throw new Test262Error('#0: new Object(undefined) return the newly created native object.');
}
assert.notSameValue(obj, undefined, 'The value of obj is expected to not equal ``undefined``');
assert.sameValue(obj.constructor, Object, 'The value of obj.constructor is expected to equal the value of Object');
// CHECK#1
if (obj.constructor !== Object) {
throw new Test262Error('#1: new Object(undefined) create a new native ECMAScript object');
}
assert(
!!Object.prototype.isPrototypeOf(obj),
'The value of !!Object.prototype.isPrototypeOf(obj) is expected to be true'
);
// CHECK#2
if (!(Object.prototype.isPrototypeOf(obj))) {
throw new Test262Error('#2: when new Object(undefined) calls the [[Prototype]] property of the newly constructed object is set to the Object prototype object.');
}
// CHECK#3
var to_string_result = '[object ' + 'Object' + ']';
if (obj.toString() !== to_string_result) {
throw new Test262Error('#3: when new Object(undefined) calls the [[Class]] property of the newly constructed object is set to "Object".');
}
assert.sameValue(obj.toString(), to_string_result, 'obj.toString() returns to_string_result');
// CHECK#4
if (obj.valueOf().toString() !== to_string_result.toString()) {
throw new Test262Error('#4: when new Object(undefined) calls the newly constructed object has no [[Value]] property.');
}
assert.sameValue(
obj.valueOf().toString(),
to_string_result.toString(),
'obj.valueOf().toString() must return the same value returned by to_string_result.toString()'
);

View File

@ -18,30 +18,21 @@ description: >
var obj = new Object(x);
// CHECK#0
if (obj === undefined) {
throw new Test262Error('#0: new Object(undefined) return the newly created native object.');
}
assert.notSameValue(obj, undefined, 'The value of obj is expected to not equal ``undefined``');
assert.sameValue(obj.constructor, Object, 'The value of obj.constructor is expected to equal the value of Object');
// CHECK#1
if (obj.constructor !== Object) {
throw new Test262Error('#1: new Object(undefined) create a new native ECMAScript object');
}
assert(
!!Object.prototype.isPrototypeOf(obj),
'The value of !!Object.prototype.isPrototypeOf(obj) is expected to be true'
);
// CHECK#2
if (!(Object.prototype.isPrototypeOf(obj))) {
throw new Test262Error('#2: when new Object(undefined) calls the [[Prototype]] property of the newly constructed object is set to the Object prototype object.');
}
// CHECK#3
var to_string_result = '[object ' + 'Object' + ']';
if (obj.toString() !== to_string_result) {
throw new Test262Error('#3: when new Object(undefined) calls the [[Class]] property of the newly constructed object is set to "Object".');
}
assert.sameValue(obj.toString(), to_string_result, 'obj.toString() returns to_string_result');
// CHECK#4
if (obj.valueOf().toString() !== to_string_result.toString()) {
throw new Test262Error('#4: when new Object(undefined) calls the newly constructed object has no [[Value]] property.');
}
assert.sameValue(
obj.valueOf().toString(),
to_string_result.toString(),
'obj.valueOf().toString() must return the same value returned by to_string_result.toString()'
);
var x;

View File

@ -15,12 +15,5 @@ var obj = {
var n_obj = new Object(obj);
//CHECK#1
if (n_obj !== obj) {
throw new Test262Error('#1: When the Object constructor is called and if the value is an Object simply value returns.');
}
//CHECK#2
if (n_obj['prop'] !== 1) {
throw new Test262Error('#2: When the Object constructor is called and if the value is an Object simply value returns.');
}
assert.sameValue(n_obj, obj, 'The value of n_obj is expected to equal the value of obj');
assert.sameValue(n_obj['prop'], 1, 'The value of n_obj["prop"] is expected to be 1');

View File

@ -15,13 +15,5 @@ var func = function() {
var n_obj = new Object(func);
//CHECK#1
if (n_obj !== func) {
throw new Test262Error('#1: When the Object constructor is called and if the value is an Object simply value returns');
}
//CHECK#2
if (n_obj() !== 1) {
throw new Test262Error('When the Object constructor is called and if the value is an Object simply value returns');
}
//
assert.sameValue(n_obj, func, 'The value of n_obj is expected to equal the value of func');
assert.sameValue(n_obj(), 1, 'n_obj() must return 1');

View File

@ -15,12 +15,5 @@ var n_obj = new Object(arr);
arr.push(4);
//CHECK#1
if (n_obj !== arr) {
throw new Test262Error('#1: When the Object constructor is called and if the value is an Object simply value returns.');
}
//CHECK#2
if (n_obj[3] !== 4) {
throw new Test262Error('#2: When the Object constructor is called and if the value is an Object simply value returns.');
}
assert.sameValue(n_obj, arr, 'The value of n_obj is expected to equal the value of arr');
assert.sameValue(n_obj[3], 4, 'The value of n_obj[3] is expected to be 4');

View File

@ -13,12 +13,6 @@ var obj = new Date(1978, 3);
var n_obj = new Object(obj);
//CHECK#1
if (n_obj !== obj) {
throw new Test262Error('#1: When the Object constructor is called and if the value is an Object simply value returns.');
}
//CHECK#2
if ((n_obj.getFullYear() !== 1978) || (n_obj.getMonth() !== 3)) {
throw new Test262Error('#2: When the Object constructor is called and if the value is an Object simply value returns.');
}
assert.sameValue(n_obj, obj, 'The value of n_obj is expected to equal the value of obj');
assert.sameValue(n_obj.getFullYear(), 1978, 'n_obj.getFullYear() must return 1978');
assert.sameValue(n_obj.getMonth(), 3, 'n_obj.getMonth() must return 3');

View File

@ -11,16 +11,9 @@ description: The value is a declared function
var n_obj = new Object(func);
//CHECK#1
if (n_obj !== func) {
throw new Test262Error('#1: When the Object constructor is called and if the value is an Object simply value returns');
}
//CHECK#2
if (n_obj() !== 1) {
throw new Test262Error('When the Object constructor is called and if the value is an Object simply value returns');
}
assert.sameValue(n_obj, func, 'The value of n_obj is expected to equal the value of func');
assert.sameValue(n_obj(), 1, 'n_obj() must return 1');
function func() {
return 1;
};
}

View File

@ -8,27 +8,17 @@ info: |
es5id: 15.2.2.1_A2_T7
description: The value is a function declaration
---*/
//CHECK#0
if (typeof func !== 'undefined') {
throw new Test262Error('#0: function expression can\'t be declarated');
}
assert.sameValue(typeof func, 'undefined', 'The value of `typeof func` is expected to be "undefined"');
var n_obj = new Object(function func() {
return 1;
});
//CHECK#1
if (n_obj.constructor !== Function) {
throw new Test262Error('#1: When the Object constructor is called and if the value is an Object simply value returns');
}
assert.sameValue(
n_obj.constructor,
Function,
'The value of n_obj.constructor is expected to equal the value of Function'
);
//CHECK#2
if (n_obj() !== 1) {
throw new Test262Error('#2: When the Object constructor is called and if the value is an Object simply value returns');
}
//CHECK#3
if (typeof func !== 'undefined') {
throw new Test262Error('#3: function expression can\'t be declarated');
}
assert.sameValue(n_obj(), 1, 'n_obj() must return 1');
assert.sameValue(typeof func, 'undefined', 'The value of `typeof func` is expected to be "undefined"');

View File

@ -11,30 +11,12 @@ description: Argument value is a nonempty string
var str = 'Obi-Wan Kenobi';
//CHECK#1
if (typeof str !== 'string') {
throw new Test262Error('#1: "Obi-Wan Kenobi" is NOT a String');
}
assert.sameValue(typeof str, 'string', 'The value of `typeof str` is expected to be "string"');
var n_obj = new Object(str);
//CHECK#2
if (n_obj.constructor !== String) {
throw new Test262Error('#2: When the Object constructor is called with String argument return ToObject(string)');
}
//CHECK#3
if (typeof n_obj !== 'object') {
throw new Test262Error('#3: When the Object constructor is called with String argument return ToObject(string)');
}
//CHECK#4
if (n_obj != str) {
throw new Test262Error('#4: When the Object constructor is called with String argument return ToObject(string)');
}
//CHECK#5
if (n_obj === str) {
throw new Test262Error('#5: When the Object constructor is called with String argument return ToObject(string)');
}
assert.sameValue(n_obj.constructor, String, 'The value of n_obj.constructor is expected to equal the value of String');
assert.sameValue(typeof n_obj, 'object', 'The value of `typeof n_obj` is expected to be "object"');
assert(n_obj == str, 'The result of evaluating (n_obj == str) is expected to be true');
assert.notSameValue(n_obj, str, 'The value of n_obj is expected to not equal the value of `str`');

View File

@ -11,29 +11,11 @@ description: Argument value is an empty string
var str = '';
//CHECK#1
if (typeof str !== 'string') {
throw new Test262Error('#1: "" is NOT a String');
}
assert.sameValue(typeof str, 'string', 'The value of `typeof str` is expected to be "string"');
var n_obj = new Object(str);
//CHECK#2
if (n_obj.constructor !== String) {
throw new Test262Error('#2: When the Object constructor is called with String argument return ToObject(string)');
}
//CHECK#3
if (typeof n_obj !== 'object') {
throw new Test262Error('#3: When the Object constructor is called with String argument return ToObject(string)');
}
//CHECK#4
if (n_obj != str) {
throw new Test262Error('#4: When the Object constructor is called with String argument return ToObject(string)');
}
//CHECK#5
if (n_obj === str) {
throw new Test262Error('#5: When the Object constructor is called with String argument return ToObject(string)');
}
assert.sameValue(n_obj.constructor, String, 'The value of n_obj.constructor is expected to equal the value of String');
assert.sameValue(typeof n_obj, 'object', 'The value of `typeof n_obj` is expected to be "object"');
assert(n_obj == str, 'The result of evaluating (n_obj == str) is expected to be true');
assert.notSameValue(n_obj, str, 'The value of n_obj is expected to not equal the value of `str`');

View File

@ -11,22 +11,7 @@ description: Argument value is sum of empty string and number
var n_obj = new Object("" + 1);
//CHECK#2
if (n_obj.constructor !== String) {
throw new Test262Error('#2: When the Object constructor is called with String argument return ToObject(string)');
}
//CHECK#3
if (typeof n_obj !== 'object') {
throw new Test262Error('#3: When the Object constructor is called with String argument return ToObject(string)');
}
//CHECK#4
if (n_obj != "1") {
throw new Test262Error('#4: When the Object constructor is called with String argument return ToObject(string)');
}
//CHECK#5
if (n_obj === "1") {
throw new Test262Error('#5: When the Object constructor is called with String argument return ToObject(string)');
}
assert.sameValue(n_obj.constructor, String, 'The value of n_obj.constructor is expected to equal the value of String');
assert.sameValue(typeof n_obj, 'object', 'The value of `typeof n_obj` is expected to be "object"');
assert(n_obj == "1", 'The result of evaluating (n_obj == "1") is expected to be true');
assert.notSameValue(n_obj, "1", 'The value of n_obj is not "1"');

View File

@ -11,29 +11,16 @@ description: Argument value is "true"
var bool = true;
//CHECK#1
if (typeof bool !== 'boolean') {
throw new Test262Error('#1: true is NOT a boolean');
}
assert.sameValue(typeof bool, 'boolean', 'The value of `typeof bool` is expected to be "boolean"');
var n_obj = new Object(bool);
//CHECK#2
if (n_obj.constructor !== Boolean) {
throw new Test262Error('#2: When the Object constructor is called with Boolean argument return ToObject(boolean)');
}
assert.sameValue(
n_obj.constructor,
Boolean,
'The value of n_obj.constructor is expected to equal the value of Boolean'
);
//CHECK#3
if (typeof n_obj !== 'object') {
throw new Test262Error('#3: When the Object constructor is called with Boolean argument return ToObject(boolean)');
}
//CHECK#4
if (n_obj != bool) {
throw new Test262Error('#4: When the Object constructor is called with Boolean argument return ToObject(boolean)');
}
//CHECK#5
if (n_obj === bool) {
throw new Test262Error('#5: When the Object constructor is called with Boolean argument return ToObject(boolean)');
}
assert.sameValue(typeof n_obj, 'object', 'The value of `typeof n_obj` is expected to be "object"');
assert(n_obj == bool, 'The result of evaluating (n_obj == bool) is expected to be true');
assert.notSameValue(n_obj, bool, 'The value of n_obj is expected to not equal the value of `bool`');

View File

@ -11,29 +11,16 @@ description: Argument value is "false"
var bool = false;
//CHECK#1
if (typeof bool !== 'boolean') {
throw new Test262Error('#1: false is NOT a boolean');
}
assert.sameValue(typeof bool, 'boolean', 'The value of `typeof bool` is expected to be "boolean"');
var n_obj = new Object(bool);
//CHECK#2
if (n_obj.constructor !== Boolean) {
throw new Test262Error('#2: When the Object constructor is called with Boolean argument return ToObject(boolean)');
}
assert.sameValue(
n_obj.constructor,
Boolean,
'The value of n_obj.constructor is expected to equal the value of Boolean'
);
//CHECK#3
if (typeof n_obj !== 'object') {
throw new Test262Error('#3: When the Object constructor is called with Boolean argument return ToObject(boolean)');
}
//CHECK#4
if (n_obj != bool) {
throw new Test262Error('#4: When the Object constructor is called with Boolean argument return ToObject(boolean)');
}
//CHECK#5
if (n_obj === bool) {
throw new Test262Error('#5: When the Object constructor is called with Boolean argument return ToObject(boolean)');
}
assert.sameValue(typeof n_obj, 'object', 'The value of `typeof n_obj` is expected to be "object"');
assert(n_obj == bool, 'The result of evaluating (n_obj == bool) is expected to be true');
assert.notSameValue(n_obj, bool, 'The value of n_obj is expected to not equal the value of `bool`');

View File

@ -11,22 +11,12 @@ description: Argument value is boolean expression
var n_obj = new Object((1 === 1) && !(false));
//CHECK#2
if (n_obj.constructor !== Boolean) {
throw new Test262Error('#2: When the Object constructor is called with Boolean argument return ToObject(boolean)');
}
assert.sameValue(
n_obj.constructor,
Boolean,
'The value of n_obj.constructor is expected to equal the value of Boolean'
);
//CHECK#3
if (typeof n_obj !== 'object') {
throw new Test262Error('#3: When the Object constructor is called with Boolean argument return ToObject(boolean)');
}
//CHECK#4
if (n_obj != true) {
throw new Test262Error('#4: When the Object constructor is called with Boolean argument return ToObject(boolean)');
}
//CHECK#5
if (n_obj === true) {
throw new Test262Error('#5: When the Object constructor is called with Boolean argument return ToObject(boolean)');
}
assert.sameValue(typeof n_obj, 'object', 'The value of `typeof n_obj` is expected to be "object"');
assert(n_obj == true, 'The result of evaluating (n_obj == true) is expected to be true');
assert.notSameValue(n_obj, true, 'The value of n_obj is not true');

View File

@ -11,29 +11,11 @@ description: Argument value is any number
var num = 1.0;
//CHECK#1
if (typeof num !== 'number') {
throw new Test262Error('#1: 1.0 is NOT a number');
}
assert.sameValue(typeof num, 'number', 'The value of `typeof num` is expected to be "number"');
var n_obj = new Object(num);
//CHECK#2
if (n_obj.constructor !== Number) {
throw new Test262Error('#2: When the Object constructor is called with Number argument return ToObject(number)');
}
//CHECK#3
if (typeof n_obj !== 'object') {
throw new Test262Error('#3: When the Object constructor is called with Number argument return ToObject(number)');
}
//CHECK#4
if (n_obj != num) {
throw new Test262Error('#4: When the Object constructor is called with Number argument return ToObject(number)');
}
//CHECK#5
if (n_obj === num) {
throw new Test262Error('#5: When the Object constructor is called with Number argument return ToObject(number)');
}
assert.sameValue(n_obj.constructor, Number, 'The value of n_obj.constructor is expected to equal the value of Number');
assert.sameValue(typeof n_obj, 'object', 'The value of `typeof n_obj` is expected to be "object"');
assert(n_obj == num, 'The result of evaluating (n_obj == num) is expected to be true');
assert.notSameValue(n_obj, num, 'The value of n_obj is expected to not equal the value of `num`');

View File

@ -11,19 +11,9 @@ description: Argument value is NaN
var num = NaN;
//CHECK#1
if (typeof num !== 'number') {
throw new Test262Error('#1: NaN is NOT a number');
}
assert.sameValue(typeof num, 'number', 'The value of `typeof num` is expected to be "number"');
var n_obj = new Object(num);
//CHECK#2
if (n_obj.constructor !== Number) {
throw new Test262Error('#2: When the Object constructor is called with Number argument return ToObject(number)');
}
//CHECK#3
if (typeof n_obj !== 'object') {
throw new Test262Error('#3: When the Object constructor is called with Number argument return ToObject(number)');
}
assert.sameValue(n_obj.constructor, Number, 'The value of n_obj.constructor is expected to equal the value of Number');
assert.sameValue(typeof n_obj, 'object', 'The value of `typeof n_obj` is expected to be "object"');

View File

@ -11,29 +11,11 @@ description: Argument value is Infinity
var num = Infinity;
//CHECK#1
if (typeof num !== 'number') {
throw new Test262Error('#1: Infinity is NOT a number');
}
assert.sameValue(typeof num, 'number', 'The value of `typeof num` is expected to be "number"');
var n_obj = new Object(num);
//CHECK#2
if (n_obj.constructor !== Number) {
throw new Test262Error('#2: When the Object constructor is called with Number argument return ToObject(number)');
}
//CHECK#3
if (typeof n_obj !== 'object') {
throw new Test262Error('#3: When the Object constructor is called with Number argument return ToObject(number)');
}
//CHECK#4
if (n_obj != num) {
throw new Test262Error('#4: When the Object constructor is called with Number argument return ToObject(number)');
}
//CHECK#5
if (n_obj === num) {
throw new Test262Error('#5: When the Object constructor is called with Number argument return ToObject(number)');
}
assert.sameValue(n_obj.constructor, Number, 'The value of n_obj.constructor is expected to equal the value of Number');
assert.sameValue(typeof n_obj, 'object', 'The value of `typeof n_obj` is expected to be "object"');
assert(n_obj == num, 'The result of evaluating (n_obj == num) is expected to be true');
assert.notSameValue(n_obj, num, 'The value of n_obj is expected to not equal the value of `num`');

View File

@ -13,22 +13,7 @@ var n_obj = new Object(2 * ([].length + {
q: 1
}["q"]));
//CHECK#2
if (n_obj.constructor !== Number) {
throw new Test262Error('#2: When the Object constructor is called with Number argument return ToObject(number)');
}
//CHECK#3
if (typeof n_obj !== 'object') {
throw new Test262Error('#3: When the Object constructor is called with Number argument return ToObject(number)');
}
//CHECK#4
if (n_obj != 2) {
throw new Test262Error('#4: When the Object constructor is called with Number argument return ToObject(number)');
}
//CHECK#5
if (n_obj === 2) {
throw new Test262Error('#5: When the Object constructor is called with Number argument return ToObject(number)');
}
assert.sameValue(n_obj.constructor, Number, 'The value of n_obj.constructor is expected to equal the value of Number');
assert.sameValue(typeof n_obj, 'object', 'The value of `typeof n_obj` is expected to be "object"');
assert(n_obj == 2, 'The result of evaluating (n_obj == 2) is expected to be true');
assert.notSameValue(n_obj, 2, 'The value of n_obj is not 2');

View File

@ -11,17 +11,8 @@ description: Creating an object with "new Object(1,2,3)"
var obj = new Object(1, 2, 3);
//CHECK#1
if (obj.constructor !== Number) {
throw new Test262Error('#1: Since Object as a function calling is the same as function calling list of arguments can appears in braces;');
}
assert.sameValue(obj.constructor, Number, 'The value of obj.constructor is expected to equal the value of Number');
assert.sameValue(typeof obj, "object", 'The value of `typeof obj` is expected to be "object"');
assert(obj == 1, 'The result of evaluating (obj == 1) is expected to be true');
assert.notSameValue(obj, 1, 'The value of obj is not 1');
//CHECK#2
if (typeof obj !== "object") {
throw new Test262Error('#2: Since Object as a function calling is the same as function calling list of arguments can appears in braces;');
}
//CHECK#3
if ((obj != 1) || (obj === 1)) {
throw new Test262Error('3#: Since Object as a function calling is the same as function calling list of arguments can appears in braces;');
}

View File

@ -11,12 +11,5 @@ description: Creating an object with "new Object(null,2,3)"
var obj = new Object(null, 2, 3);
//CHECK#1
if (obj.constructor !== Object) {
throw new Test262Error('#1: Since Object as a function calling is the same as function calling list of arguments can appears in braces;');
}
//CHECK#2
if (typeof obj !== "object") {
throw new Test262Error('#2: Since Object as a function calling is the same as function calling list of arguments can appears in braces;');
}
assert.sameValue(obj.constructor, Object, 'The value of obj.constructor is expected to equal the value of Object');
assert.sameValue(typeof obj, "object", 'The value of `typeof obj` is expected to be "object"');

View File

@ -11,17 +11,7 @@ description: Creating an object with "new Object((null,2,3),2,3)"
var obj = new Object((null, 2, 3), 1, 2);
//CHECK#1
if (obj.constructor !== Number) {
throw new Test262Error('#1: Since Object as a function calling is the same as function calling list of arguments can appears in braces;');
}
//CHECK#2
if (typeof obj !== "object") {
throw new Test262Error('#2: Since Object as a function calling is the same as function calling list of arguments can appears in braces;');
}
//CHECK#3
if ((obj != 3) || (obj === 3)) {
throw new Test262Error('3#: Since Object as a function calling is the same as function calling list of arguments can appears in braces;');
}
assert.sameValue(obj.constructor, Number, 'The value of obj.constructor is expected to equal the value of Number');
assert.sameValue(typeof obj, "object", 'The value of `typeof obj` is expected to be "object"');
assert(obj == 3, 'The result of evaluating (obj == 3) is expected to be true');
assert.notSameValue(obj, 3, 'The value of obj is not 3');

View File

@ -6,7 +6,7 @@ info: The Object constructor has the property "prototype"
es5id: 15.2.3_A1
description: Checking existence of the property "prototype"
---*/
if (!Object.hasOwnProperty("prototype")) {
throw new Test262Error('#1: The Object constructor has the property "prototype"');
}
assert(
!!Object.hasOwnProperty("prototype"),
'The value of !!Object.hasOwnProperty("prototype") is expected to be true'
);

View File

@ -8,8 +8,7 @@ info: |
es5id: 15.2.3_A2
description: Checking Function.prototype.isPrototypeOf(Object)
---*/
// CHECK#
if (!(Function.prototype.isPrototypeOf(Object))) {
throw new Test262Error('#1: the value of the internal [[Prototype]] property of the Object constructor is the Function prototype object.');
}
assert(
!!Function.prototype.isPrototypeOf(Object),
'The value of !!Function.prototype.isPrototypeOf(Object) is expected to be true'
);

View File

@ -6,13 +6,9 @@ info: Object constructor has length property whose value is 1
es5id: 15.2.3_A3
description: Checking Object.length
---*/
assert(
!!Object.hasOwnProperty("length"),
'The value of !!Object.hasOwnProperty("length") is expected to be true'
);
//CHECK#1
if (!Object.hasOwnProperty("length")) {
throw new Test262Error('#1: The Object constructor has the property "length"');
}
//CHECK#2
if (Object.length !== 1) {
throw new Test262Error('#2: Object.length property value should be 1');
}
assert.sameValue(Object.length, 1, 'The value of Object.length is expected to be 1');

View File

@ -11,6 +11,4 @@ var obj = Object;
var thisobj = this.Object;
if (obj !== thisobj) {
throw new Test262Error('Object is the property of global');
}
assert.sameValue(obj, thisobj, 'The value of obj is expected to equal the value of thisobj');

View File

@ -8,33 +8,20 @@ info: |
es5id: 9.9_A3
description: Trying to convert from Boolean to Object
---*/
assert.sameValue(Object(true).valueOf(), true, 'Object(true).valueOf() must return true');
assert.sameValue(typeof Object(true), "object", 'The value of `typeof Object(true)` is expected to be "object"');
// CHECK#1
if (Object(true).valueOf() !== true) {
throw new Test262Error('#1: Object(true).valueOf() === true. Actual: ' + (Object(true).valueOf()));
}
assert.sameValue(
Object(true).constructor.prototype,
Boolean.prototype,
'The value of Object(true).constructor.prototype is expected to equal the value of Boolean.prototype'
);
// CHECK#2
if (typeof Object(true) !== "object") {
throw new Test262Error('#2: typeof Object(true) === "object". Actual: ' + (typeof Object(true)));
}
assert.sameValue(Object(false).valueOf(), false, 'Object(false).valueOf() must return false');
assert.sameValue(typeof Object(false), "object", 'The value of `typeof Object(false)` is expected to be "object"');
// CHECK#3
if (Object(true).constructor.prototype !== Boolean.prototype) {
throw new Test262Error('#3: Object(true).constructor.prototype === Boolean.prototype. Actual: ' + (Object(true).constructor.prototype));
}
// CHECK#4
if (Object(false).valueOf() !== false) {
throw new Test262Error('#4: Object(false).valueOf() === false. Actual: ' + (Object(false).valueOf()));
}
// CHECK#5
if (typeof Object(false) !== "object") {
throw new Test262Error('#5: typeof Object(false) === "object". Actual: ' + (typeof Object(false)));
}
// CHECK#6
if (Object(false).constructor.prototype !== Boolean.prototype) {
throw new Test262Error('#6: Object(false).constructor.prototype === Boolean.prototype. Actual: ' + (Object(false).constructor.prototype));
}
assert.sameValue(
Object(false).constructor.prototype,
Boolean.prototype,
'The value of Object(false).constructor.prototype is expected to equal the value of Boolean.prototype'
);

View File

@ -8,168 +8,142 @@ info: |
es5id: 9.9_A4
description: Converting from various numbers to Object
---*/
assert.sameValue(Object(0).valueOf(), 0, 'Object(0).valueOf() must return 0');
assert.sameValue(typeof Object(0), "object", 'The value of `typeof Object(0)` is expected to be "object"');
// CHECK#1
if (Object(0).valueOf() !== 0) {
throw new Test262Error('#1: Object(0).valueOf() === 0. Actual: ' + (Object(0).valueOf()));
}
assert.sameValue(
Object(0).constructor.prototype,
Number.prototype,
'The value of Object(0).constructor.prototype is expected to equal the value of Number.prototype'
);
// CHECK#2
if (typeof Object(0) !== "object") {
throw new Test262Error('#2: typeof Object(0) === "object". Actual: ' + (typeof Object(0)));
}
assert.sameValue(Object(-0).valueOf(), -0, 'Object(-0).valueOf() must return -0');
assert.sameValue(typeof Object(-0), "object", 'The value of `typeof Object(-0)` is expected to be "object"');
// CHECK#3
if (Object(0).constructor.prototype !== Number.prototype) {
throw new Test262Error('#3: Object(0).constructor.prototype === Number.prototype. Actual: ' + (Object(0).constructor.prototype));
}
assert.sameValue(
Object(-0).constructor.prototype,
Number.prototype,
'The value of Object(-0).constructor.prototype is expected to equal the value of Number.prototype'
);
// CHECK#4
if (Object(-0).valueOf() !== -0) {
throw new Test262Error('#4.1: Object(-0).valueOf() === 0. Actual: ' + (Object(-0).valueOf()));
} else if (1 / Object(-0).valueOf() !== Number.NEGATIVE_INFINITY) {
throw new Test262Error('#4.2: Object(-0).valueOf() === -0. Actual: +0');
}
assert.sameValue(Object(1).valueOf(), 1, 'Object(1).valueOf() must return 1');
assert.sameValue(typeof Object(1), "object", 'The value of `typeof Object(1)` is expected to be "object"');
// CHECK#5
if (typeof Object(-0) !== "object") {
throw new Test262Error('#5: typeof Object(-0) === "object". Actual: ' + (typeof Object(-0)));
}
assert.sameValue(
Object(1).constructor.prototype,
Number.prototype,
'The value of Object(1).constructor.prototype is expected to equal the value of Number.prototype'
);
// CHECK#6
if (Object(-0).constructor.prototype !== Number.prototype) {
throw new Test262Error('#6: Object(-0).constructor.prototype === Number.prototype. Actual: ' + (Object(-0).constructor.prototype));
}
assert.sameValue(Object(-1).valueOf(), -1, 'Object(-1).valueOf() must return -1');
assert.sameValue(typeof Object(-1), "object", 'The value of `typeof Object(-1)` is expected to be "object"');
// CHECK#7
if (Object(1).valueOf() !== 1) {
throw new Test262Error('#7: Object(1).valueOf() === 1. Actual: ' + (Object(1).valueOf()));
}
assert.sameValue(
Object(-1).constructor.prototype,
Number.prototype,
'The value of Object(-1).constructor.prototype is expected to equal the value of Number.prototype'
);
// CHECK#8
if (typeof Object(1) !== "object") {
throw new Test262Error('#8: typeof Object(1) === "object". Actual: ' + (typeof Object(1)));
}
assert.sameValue(
Object(Number.MIN_VALUE).valueOf(),
Number.MIN_VALUE,
'Object(Number.MIN_VALUE).valueOf() returns Number.MIN_VALUE'
);
// CHECK#9
if (Object(1).constructor.prototype !== Number.prototype) {
throw new Test262Error('#9: Object(1).constructor.prototype === Number.prototype. Actual: ' + (Object(1).constructor.prototype));
}
assert.sameValue(
typeof Object(Number.MIN_VALUE),
"object",
'The value of `typeof Object(Number.MIN_VALUE)` is expected to be "object"'
);
// CHECK#10
if (Object(-1).valueOf() !== -1) {
throw new Test262Error('#10: Object(-1).valueOf() === -1. Actual: ' + (Object(-1).valueOf()));
}
assert.sameValue(
Object(Number.MIN_VALUE).constructor.prototype,
Number.prototype,
'The value of Object(Number.MIN_VALUE).constructor.prototype is expected to equal the value of Number.prototype'
);
// CHECK#11
if (typeof Object(-1) !== "object") {
throw new Test262Error('#11: typeof Object(-1) === "object". Actual: ' + (typeof Object(-1)));
}
assert.sameValue(
Object(Number.MAX_VALUE).valueOf(),
Number.MAX_VALUE,
'Object(Number.MAX_VALUE).valueOf() returns Number.MAX_VALUE'
);
// CHECK#12
if (Object(-1).constructor.prototype !== Number.prototype) {
throw new Test262Error('#12: Object(-1).constructor.prototype === Number.prototype. Actual: ' + (Object(-1).constructor.prototype));
}
assert.sameValue(
typeof Object(Number.MAX_VALUE),
"object",
'The value of `typeof Object(Number.MAX_VALUE)` is expected to be "object"'
);
// CHECK#13
if (Object(Number.MIN_VALUE).valueOf() !== Number.MIN_VALUE) {
throw new Test262Error('#13: Object(Number.MIN_VALUE).valueOf() === Number.MIN_VALUE. Actual: ' + (Object(Number.MIN_VALUE).valueOf()));
}
assert.sameValue(
Object(Number.MAX_VALUE).constructor.prototype,
Number.prototype,
'The value of Object(Number.MAX_VALUE).constructor.prototype is expected to equal the value of Number.prototype'
);
// CHECK#14
if (typeof Object(Number.MIN_VALUE) !== "object") {
throw new Test262Error('#14: typeof Object(Number.MIN_VALUE) === "object". Actual: ' + (typeof Object(Number.MIN_VALUE)));
}
assert.sameValue(
Object(Number.POSITIVE_INFINITY).valueOf(),
Number.POSITIVE_INFINITY,
'Object(Number.POSITIVE_INFINITY).valueOf() returns Number.POSITIVE_INFINITY'
);
// CHECK#15
if (Object(Number.MIN_VALUE).constructor.prototype !== Number.prototype) {
throw new Test262Error('#15: Object(Number.MIN_VALUE).constructor.prototype === Number.prototype. Actual: ' + (Object(Number.MIN_VALUE).constructor.prototype));
}
assert.sameValue(
typeof Object(Number.POSITIVE_INFINITY),
"object",
'The value of `typeof Object(Number.POSITIVE_INFINITY)` is expected to be "object"'
);
// CHECK#16
if (Object(Number.MAX_VALUE).valueOf() !== Number.MAX_VALUE) {
throw new Test262Error('#16: Object(Number.MAX_VALUE).valueOf() === Number.MAX_VALUE. Actual: ' + (Object(Number.MAX_VALUE).valueOf()));
}
assert.sameValue(
Object(Number.POSITIVE_INFINITY).constructor.prototype,
Number.prototype,
'The value of Object(Number.POSITIVE_INFINITY).constructor.prototype is expected to equal the value of Number.prototype'
);
// CHECK#17
if (typeof Object(Number.MAX_VALUE) !== "object") {
throw new Test262Error('#17: typeof Object(Number.MAX_VALUE) === "object". Actual: ' + (typeof Object(Number.MAX_VALUE)));
}
assert.sameValue(
Object(Number.NEGATIVE_INFINITY).valueOf(),
Number.NEGATIVE_INFINITY,
'Object(Number.NEGATIVE_INFINITY).valueOf() returns Number.NEGATIVE_INFINITY'
);
// CHECK#18
if (Object(Number.MAX_VALUE).constructor.prototype !== Number.prototype) {
throw new Test262Error('#18: Object(Number.MAX_VALUE).constructor.prototype === Number.prototype. Actual: ' + (Object(Number.MAX_VALUE).constructor.prototype));
}
assert.sameValue(
typeof Object(Number.NEGATIVE_INFINITY),
"object",
'The value of `typeof Object(Number.NEGATIVE_INFINITY)` is expected to be "object"'
);
// CHECK#19
if (Object(Number.POSITIVE_INFINITY).valueOf() !== Number.POSITIVE_INFINITY) {
throw new Test262Error('#19: Object(Number.POSITIVE_INFINITY).valueOf() === Number.POSITIVE_INFINITY. Actual: ' + (Object(Number.POSITIVE_INFINITY).valueOf()));
}
assert.sameValue(
Object(Number.NEGATIVE_INFINITY).constructor.prototype,
Number.prototype,
'The value of Object(Number.NEGATIVE_INFINITY).constructor.prototype is expected to equal the value of Number.prototype'
);
// CHECK#20
if (typeof Object(Number.POSITIVE_INFINITY) !== "object") {
throw new Test262Error('#20: typeof Object(Number.POSITIVE_INFINITY) === "object". Actual: ' + (typeof Object(Number.POSITIVE_INFINITY)));
}
assert.sameValue(Object(NaN).valueOf(), NaN, 'Object(NaN).valueOf() returns NaN');
// CHECK#21
if (Object(Number.POSITIVE_INFINITY).constructor.prototype !== Number.prototype) {
throw new Test262Error('#21: Object(Number.POSITIVE_INFINITY).constructor.prototype === Number.prototype. Actual: ' + (Object(Number.POSITIVE_INFINITY).constructor.prototype));
}
assert.sameValue(
typeof Object(Number.NaN),
"object",
'The value of `typeof Object(Number.NaN)` is expected to be "object"'
);
// CHECK#22
if (Object(Number.NEGATIVE_INFINITY).valueOf() !== Number.NEGATIVE_INFINITY) {
throw new Test262Error('#22: Object(Number.NEGATIVE_INFINITY).valueOf() === Number.NEGATIVE_INFINITY. Actual: ' + (Object(Number.NEGATIVE_INFINITY).valueOf()));
}
assert.sameValue(
Object(Number.NaN).constructor.prototype,
Number.prototype,
'The value of Object(Number.NaN).constructor.prototype is expected to equal the value of Number.prototype'
);
// CHECK#23
if (typeof Object(Number.NEGATIVE_INFINITY) !== "object") {
throw new Test262Error('#23: typeof Object(Number.NEGATIVE_INFINITY) === "object". Actual: ' + (typeof Object(Number.NEGATIVE_INFINITY)));
}
assert.sameValue(Object(1.2345).valueOf(), 1.2345, 'Object(1.2345).valueOf() must return 1.2345');
assert.sameValue(typeof Object(1.2345), "object", 'The value of `typeof Object(1.2345)` is expected to be "object"');
// CHECK#24
if (Object(Number.NEGATIVE_INFINITY).constructor.prototype !== Number.prototype) {
throw new Test262Error('#24: Object(Number.NEGATIVE_INFINITY).constructor.prototype === Number.prototype. Actual: ' + (Object(Number.NEGATIVE_INFINITY).constructor.prototype));
}
assert.sameValue(
Object(1.2345).constructor.prototype,
Number.prototype,
'The value of Object(1.2345).constructor.prototype is expected to equal the value of Number.prototype'
);
// CHECK#25
assert.sameValue(Object(NaN).valueOf(), NaN, "Object(NaN).valueOf()");
assert.sameValue(Object(-1.2345).valueOf(), -1.2345, 'Object(-1.2345).valueOf() must return -1.2345');
assert.sameValue(typeof Object(-1.2345), "object", 'The value of `typeof Object(-1.2345)` is expected to be "object"');
// CHECK#26
if (typeof Object(Number.NaN) !== "object") {
throw new Test262Error('#26: typeof Object(Number.NaN) === "object". Actual: ' + (typeof Object(Number.NaN)));
}
// CHECK#27
if (Object(Number.NaN).constructor.prototype !== Number.prototype) {
throw new Test262Error('#27: Object(Number.NaN).constructor.prototype === Number.prototype. Actual: ' + (Object(Number.NaN).constructor.prototype));
}
// CHECK#28
if (Object(1.2345).valueOf() !== 1.2345) {
throw new Test262Error('#28: Object(1.2345).valueOf() === 1.2345. Actual: ' + (Object(1.2345).valueOf()));
}
// CHECK#29
if (typeof Object(1.2345) !== "object") {
throw new Test262Error('#29: typeof Object(1.2345) === "object". Actual: ' + (typeof Object(1.2345)));
}
// CHECK#30
if (Object(1.2345).constructor.prototype !== Number.prototype) {
throw new Test262Error('#30: Object(1.2345).constructor.prototype === Number.prototype. Actual: ' + (Object(1.2345).constructor.prototype));
}
// CHECK#31
if (Object(-1.2345).valueOf() !== -1.2345) {
throw new Test262Error('#31: Object(-1.2345).valueOf() === -1.2345. Actual: ' + (Object(-1.2345).valueOf()));
}
// CHECK#32
if (typeof Object(-1.2345) !== "object") {
throw new Test262Error('#32: typeof Object(-1.2345) === "object". Actual: ' + (typeof Object(-1.2345)));
}
// CHECK#33
if (Object(-1.2345).constructor.prototype !== Number.prototype) {
throw new Test262Error('#33: Object(-1.2345).constructor.prototype === Number.prototype. Actual: ' + (Object(-1.2345).constructor.prototype));
}
assert.sameValue(
Object(-1.2345).constructor.prototype,
Number.prototype,
'The value of Object(-1.2345).constructor.prototype is expected to equal the value of Number.prototype'
);

View File

@ -8,63 +8,57 @@ info: |
es5id: 9.9_A5
description: Converting from various strings to Object
---*/
assert.sameValue(
Object("some string").valueOf(),
"some string",
'Object("some string").valueOf() must return "some string"'
);
// CHECK#1
if (Object("some string").valueOf() !== "some string") {
throw new Test262Error('#1: Object("some string").valueOf() === "some string". Actual: ' + (Object("some string").valueOf()));
}
assert.sameValue(
typeof Object("some string"),
"object",
'The value of `typeof Object("some string")` is expected to be "object"'
);
// CHECK#2
if (typeof Object("some string") !== "object") {
throw new Test262Error('#2: typeof Object("some string") === "object". Actual: ' + (typeof Object("some string")));
}
assert.sameValue(
Object("some string").constructor.prototype,
String.prototype,
'The value of Object("some string").constructor.prototype is expected to equal the value of String.prototype'
);
// CHECK#3
if (Object("some string").constructor.prototype !== String.prototype) {
throw new Test262Error('#3: Object("some string").constructor.prototype === String.prototype. Actual: ' + (Object("some string").constructor.prototype));
}
assert.sameValue(Object("").valueOf(), "", 'Object("").valueOf() must return ""');
assert.sameValue(typeof Object(""), "object", 'The value of `typeof Object("")` is expected to be "object"');
// CHECK#4
if (Object("").valueOf() !== "") {
throw new Test262Error('#4: Object("").valueOf() === false. Actual: ' + (Object("").valueOf()));
}
assert.sameValue(
Object("").constructor.prototype,
String.prototype,
'The value of Object("").constructor.prototype is expected to equal the value of String.prototype'
);
// CHECK#5
if (typeof Object("") !== "object") {
throw new Test262Error('#5: typeof Object("") === "object". Actual: ' + (typeof Object("")));
}
assert.sameValue(Object("\r\t\b\n\v\f").valueOf(), "\r\t\b\n\v\f", 'Object("rtbnvf").valueOf() must return "rtbnvf"');
// CHECK#6
if (Object("").constructor.prototype !== String.prototype) {
throw new Test262Error('#6: Object("").constructor.prototype === String.prototype. Actual: ' + (Object("").constructor.prototype));
}
assert.sameValue(
typeof Object("\r\t\b\n\v\f"),
"object",
'The value of `typeof Object("rtbnvf")` is expected to be "object"'
);
// CHECK#7
if (Object("\r\t\b\n\v\f").valueOf() !== "\r\t\b\n\v\f") {
throw new Test262Error('#7: Object("\\r\\t\\b\\n\\v\\f").valueOf() === false. Actual: ' + (Object("\r\t\b\n\v\f").valueOf()));
}
assert.sameValue(
Object("\r\t\b\n\v\f").constructor.prototype,
String.prototype,
'The value of Object("rtbnvf").constructor.prototype is expected to equal the value of String.prototype'
);
// CHECK#8
if (typeof Object("\r\t\b\n\v\f") !== "object") {
throw new Test262Error('#8: typeof Object("\\r\\t\\b\\n\\v\\f") === "object". Actual: ' + (typeof Object("\r\t\b\n\v\f")));
}
assert.sameValue(Object(String(10)).valueOf(), "10", 'Object(String(10)).valueOf() must return "10"');
// CHECK#9
if (Object("\r\t\b\n\v\f").constructor.prototype !== String.prototype) {
throw new Test262Error('#9: Object("\\r\\t\\b\\n\\v\\f").constructor.prototype === String.prototype. Actual: ' + (Object("\r\t\b\n\v\f").constructor.prototype));
}
assert.sameValue(
typeof Object(String(10)),
"object",
'The value of `typeof Object(String(10))` is expected to be "object"'
);
// CHECK#10
if (Object(String(10)).valueOf() !== "10") {
throw new Test262Error('#10: Object(String(10)).valueOf() === false. Actual: ' + (Object(String(10)).valueOf()));
}
// CHECK#11
if (typeof Object(String(10)) !== "object") {
throw new Test262Error('#11: typeof Object(String(10)) === "object". Actual: ' + (typeof Object(String(10))));
}
// CHECK#12
if (Object(String(10)).constructor.prototype !== String.prototype) {
throw new Test262Error('#12: Object(String(10)).constructor.prototype === String.prototype. Actual: ' + (Object(String(10)).constructor.prototype));
}
assert.sameValue(
Object(String(10)).constructor.prototype,
String.prototype,
'The value of Object(String(10)).constructor.prototype is expected to equal the value of String.prototype'
);

View File

@ -19,23 +19,13 @@ function MyObject(val) {
var x = new MyObject(1);
var y = Object(x);
// CHECK#1
if (y.valueOf() !== x.valueOf()) {
throw new Test262Error('#1: Object(obj).valueOf() === obj.valueOf(). Actual: ' + (Object(obj).valueOf()));
}
assert.sameValue(y.valueOf(), x.valueOf(), 'y.valueOf() must return the same value returned by x.valueOf()');
assert.sameValue(typeof y, typeof x, 'The value of `typeof y` is expected to be typeof x');
// CHECK#2
if (typeof y !== typeof x) {
throw new Test262Error('#2: typeof Object(obj) === typeof obj. Actual: ' + (typeof Object(obj)));
}
assert.sameValue(
y.constructor.prototype,
x.constructor.prototype,
'The value of y.constructor.prototype is expected to equal the value of x.constructor.prototype'
);
// CHECK#3
if (y.constructor.prototype !== x.constructor.prototype) {
throw new Test262Error('#3: Object(obj).constructor.prototype === obj.constructor.prototype. Actual: ' + (Object(obj).constructor.prototype));
}
// CHECK#4
if (y !== x) {
throw new Test262Error('#4: Object(obj) === obj');
}
assert.sameValue(y, x, 'The value of y is expected to equal the value of x');

View File

@ -9,4 +9,4 @@ esid: sec-object.assign
var target = new Object();
var result = Object.assign(target, undefined, null);
assert.sameValue(result, target, "null and undefined should be ignored, result should be original object.");
assert.sameValue(result, target, 'The value of result is expected to equal the value of target');

View File

@ -12,4 +12,4 @@ features: [Symbol]
var target = new Object();
var result = Object.assign(target, 123, true, Symbol('foo'));
assert.sameValue(result, target, "Numbers, booleans, and symbols cannot have wrappers with own enumerable properties.");
assert.sameValue(result, target, 'The value of result is expected to equal the value of target');

View File

@ -9,6 +9,6 @@ esid: sec-object.assign
var target = new Object();
var result = Object.assign(target, "123");
assert.sameValue(result[0], "1", "The value should be {\"0\":\"1\"}.");
assert.sameValue(result[1], "2", "The value should be {\"1\":\"2\"}.");
assert.sameValue(result[2], "3", "The value should be {\"2\":\"3\"}.");
assert.sameValue(result[0], "1", 'The value of result[0] is expected to be "1"');
assert.sameValue(result[1], "2", 'The value of result[1] is expected to be "2"');
assert.sameValue(result[2], "3", 'The value of result[2] is expected to be "3"');

View File

@ -31,8 +31,6 @@ if (typeof document !== 'undefined' &&
}
if (!refused) {
var desc = Object.getOwnPropertyDescriptor(f, 'foo');
if (desc.get !== getter) {
throw new Test262Error('Getter on HTMLFormElement disappears');
}
assert.sameValue(desc.get, getter, 'The value of desc.get is expected to equal the value of getter');
}
}

View File

@ -17,6 +17,8 @@ function getter() {
Object.defineProperty(base, 'foo', {
get: getter
});
if (derived.hasOwnProperty('foo')) {
throw new Test262Error('Accessor properties inherit as own properties');
}
assert(
!derived.hasOwnProperty('foo'),
'The value of !derived.hasOwnProperty("foo") is expected to be true'
);

View File

@ -16,7 +16,5 @@ function foo() {}
var names = Object.getOwnPropertyNames(foo);
for (var i = 0, len = names.length; i < len; i++) {
if (!foo.hasOwnProperty(names[i])) {
throw new Test262Error('Phantom own property: ' + names[i]);
}
assert(!!foo.hasOwnProperty(names[i]), 'The value of !!foo.hasOwnProperty(names[i]) is expected to be true');
}

View File

@ -13,15 +13,15 @@ verifyNotWritable(Object, "prototype", null, function() {
return "shifted";
});
//CHECK#1
if (Object.prototype !== obj) {
throw new Test262Error('#1: the Object.prototype property has the attributes ReadOnly.');
}
assert.sameValue(Object.prototype, obj, 'The value of Object.prototype is expected to equal the value of obj');
//CHECK#2
try {
Object.prototype();
throw new Test262Error('#2: the Object.prototype property has the attributes ReadOnly');
} catch (e) {
if (e instanceof Test262Error) throw e;
if (e instanceof Test262Error) {
throw e;
}
}
// TODO: Convert to verifyProperty() format.

View File

@ -6,19 +6,19 @@ info: The Object.prototype property has the attribute DontEnum
es5id: 15.2.3.1_A2
description: Checking if enumerating "Object.prototype" property fails
---*/
assert(
!Object.propertyIsEnumerable('prototype'),
'The value of !Object.propertyIsEnumerable("prototype") is expected to be true'
);
// CHECK#1
if (Object.propertyIsEnumerable('prototype')) {
throw new Test262Error('#1: the Object.prototype property has the attributes DontEnum');
}
// CHECK#2
var cout = 0;
for (var p in Object) {
if (p === "prototype") cout++;
if (p === "prototype") {
cout++;
}
}
if (cout !== 0) {
throw new Test262Error('#2: the Object.prototype property has the attributes DontEnum');
}
assert.sameValue(cout, 0, 'The value of cout is expected to be 0');
// TODO: Convert to verifyProperty() format.

View File

@ -9,17 +9,17 @@ includes: [propertyHelper.js]
verifyNotConfigurable(Object, "prototype");
//CHECK#1
try {
if ((delete Object.prototype) !== false) {
throw new Test262Error('#1: Object.prototype has the attribute DontDelete');
}
assert.sameValue(delete Object.prototype, false, 'The value of `delete Object.prototype` is expected to be false');
} catch (e) {
if (e instanceof Test262Error) throw e;
assert(e instanceof TypeError);
if (e instanceof Test262Error) {
throw e;
}
assert(e instanceof TypeError, 'The result of evaluating (e instanceof TypeError) is expected to be true');
}
//CHECK#2
if (!(Object.hasOwnProperty('prototype'))) {
throw new Test262Error('#2: the Object.prototype property has the attributes DontDelete.');
}
// TODO: Convert to verifyProperty() format.

View File

@ -6,8 +6,8 @@ info: Object prototype object has not prototype
es5id: 15.2.4_A1_T1
description: Checking if obtaining Object.prototype.prototype fails
---*/
// CHECK#1
if (Object.prototype.prototype !== undefined) {
throw new Test262Error('#1: Object prototype has not prototype');
}
assert.sameValue(
Object.prototype.prototype,
undefined,
'The value of Object.prototype.prototype is expected to equal undefined'
);

View File

@ -8,21 +8,18 @@ description: >
Since the Object prototype object has not prototype, deleted
toString method can not be found in prototype chain
---*/
//CHECK#1
if (Object.prototype.toString() == false) {
throw new Test262Error('#1: Object prototype object has not prototype');
}
assert.notSameValue(Object.prototype.toString(), false, 'Object.prototype.toString() must return false');
delete Object.prototype.toString;
// CHECK#2
try {
Object.prototype.toString();
throw new Test262Error('#2: Object prototype object has not prototype');
} catch (e) {
if ((e instanceof TypeError) !== true) {
throw new Test262Error('#1.1: delete Object.prototype.toString; Object.prototype.toString() throw a TypeError. Actual: ' + (e));
}
assert.sameValue(
e instanceof TypeError,
true,
'The result of evaluating (e instanceof TypeError) is expected to be true'
);
}
//

View File

@ -13,7 +13,4 @@ description: >
var tostr = Object.prototype.toString();
//CHECK#1
if (tostr !== "[object Object]") {
throw new Test262Error('#1: the value of the internal [[Class]] property of Object prototype object is "Object"');
}
assert.sameValue(tostr, "[object Object]", 'The value of tostr is expected to be "[object Object]"');

View File

@ -11,4 +11,4 @@ description: Checking if calling Object prototype as a function fails
assert.throws(TypeError, function() {
Object.prototype();
});
}, 'Object.prototype() throws a TypeError exception');

View File

@ -11,4 +11,4 @@ description: Checking if creating "new Object.prototype" fails
assert.throws(TypeError, function() {
new Object.prototype;
});
}, '`new Object.prototype` throws a TypeError exception');

View File

@ -8,8 +8,8 @@ info: |
es5id: 15.2.4.1_A1_T1
description: Checking the Object.prototype.constructor
---*/
//CHECK#1
if (Object.prototype.constructor !== Object) {
throw new Test262Error('#1: The initial value of Object.prototype.constructor is the built-in Object constructor');
}
assert.sameValue(
Object.prototype.constructor,
Object,
'The value of Object.prototype.constructor is expected to equal the value of Object'
);

View File

@ -15,28 +15,14 @@ var constr = Object.prototype.constructor;
var obj = new constr;
// CHECK#0
if (obj === undefined) {
throw new Test262Error('#0: new Object() return the newly created native object.');
}
assert.notSameValue(obj, undefined, 'The value of obj is expected to not equal ``undefined``');
assert.sameValue(obj.constructor, Object, 'The value of obj.constructor is expected to equal the value of Object');
// CHECK#1
if (obj.constructor !== Object) {
throw new Test262Error('#1: new Object() create a new native ECMAScript object');
}
assert(
!!Object.prototype.isPrototypeOf(obj),
'The value of !!Object.prototype.isPrototypeOf(obj) is expected to be true'
);
// CHECK#2
if (!(Object.prototype.isPrototypeOf(obj))) {
throw new Test262Error('#2: when new Object() calls the [[Prototype]] property of the newly constructed object is set to the Object prototype object.');
}
// CHECK#3
var to_string_result = '[object ' + 'Object' + ']';
if (obj.toString() !== to_string_result) {
throw new Test262Error('#3: when new Object() calls the [[Class]] property of the newly constructed object is set to "Object".');
}
// CHECK#4
if (obj.valueOf().toString() !== to_string_result) {
throw new Test262Error('#4: when new Object() calls the newly constructed object has no [[Value]] property.');
}
assert.sameValue(obj.toString(), to_string_result, 'obj.toString() returns to_string_result');
assert.sameValue(obj.valueOf().toString(), to_string_result, 'obj.valueOf().toString() returns to_string_result');

View File

@ -10,4 +10,4 @@ description: >
assert.throws(TypeError, function() {
Object.prototype.hasOwnProperty.call(undefined, 'foo');
});
}, 'Object.prototype.hasOwnProperty.call(undefined, "foo") throws a TypeError exception');

View File

@ -10,4 +10,4 @@ description: >
assert.throws(TypeError, function() {
Object.prototype.hasOwnProperty.call(null, 'foo');
});
}, 'Object.prototype.hasOwnProperty.call(null, "foo") throws a TypeError exception');

View File

@ -13,14 +13,13 @@ description: >
Checking type of the Object.prototype.hasOwnProperty and the
returned result
---*/
assert.sameValue(
typeof Object.prototype.hasOwnProperty,
"function",
'The value of `typeof Object.prototype.hasOwnProperty` is expected to be "function"'
);
//CHECK#1
if (typeof Object.prototype.hasOwnProperty !== "function") {
throw new Test262Error('#1: hasOwnProperty method is defined');
}
//CHECK#2
if (!(Object.prototype.hasOwnProperty("hasOwnProperty"))) {
throw new Test262Error('#2: hasOwnProperty method works properly');
}
//
assert(
!!Object.prototype.hasOwnProperty("hasOwnProperty"),
'The value of !!Object.prototype.hasOwnProperty("hasOwnProperty") is expected to be true'
);

View File

@ -11,28 +11,28 @@ info: |
es5id: 15.2.4.5_A1_T2
description: Argument of the hasOwnProperty method is a custom boolean property
---*/
//CHECK#1
if (typeof Object.prototype.hasOwnProperty !== "function") {
throw new Test262Error('#1: hasOwnProperty method is defined');
}
assert.sameValue(
typeof Object.prototype.hasOwnProperty,
"function",
'The value of `typeof Object.prototype.hasOwnProperty` is expected to be "function"'
);
var obj = {
the_property: true
};
//CHECK#2
if (typeof obj.hasOwnProperty !== "function") {
throw new Test262Error('#2: hasOwnProperty method is accessed');
}
assert.sameValue(
typeof obj.hasOwnProperty,
"function",
'The value of `typeof obj.hasOwnProperty` is expected to be "function"'
);
//CHECK#3
if (obj.hasOwnProperty("hasOwnProperty")) {
throw new Test262Error('#3: hasOwnProperty method works properly');
}
assert(
!obj.hasOwnProperty("hasOwnProperty"),
'The value of !obj.hasOwnProperty("hasOwnProperty") is expected to be true'
);
//CHECK#4
if (!(obj.hasOwnProperty("the_property"))) {
throw new Test262Error('#4: hasOwnProperty method works properly');
}
//
assert(
!!obj.hasOwnProperty("the_property"),
'The value of !!obj.hasOwnProperty("the_property") is expected to be true'
);

View File

@ -20,22 +20,24 @@ var FACTORY = function() {
var instance = new FACTORY;
//CHECK#1
if (typeof Object.prototype.hasOwnProperty !== "function") {
throw new Test262Error('#1: hasOwnProperty method is defined');
}
assert.sameValue(
typeof Object.prototype.hasOwnProperty,
"function",
'The value of `typeof Object.prototype.hasOwnProperty` is expected to be "function"'
);
//CHECK#2
if (typeof instance.hasOwnProperty !== "function") {
throw new Test262Error('#2: hasOwnProperty method is accessed');
}
assert.sameValue(
typeof instance.hasOwnProperty,
"function",
'The value of `typeof instance.hasOwnProperty` is expected to be "function"'
);
//CHECK#3
if (instance.hasOwnProperty("toString")) {
throw new Test262Error('#3: hasOwnProperty method works properly');
}
assert(
!instance.hasOwnProperty("toString"),
'The value of !instance.hasOwnProperty("toString") is expected to be true'
);
//CHECK#4
if (!(instance.hasOwnProperty("aproperty"))) {
throw new Test262Error('#4: hasOwnProperty method works properly');
}
assert(
!!instance.hasOwnProperty("aproperty"),
'The value of !!instance.hasOwnProperty("aproperty") is expected to be true'
);

View File

@ -8,9 +8,8 @@ description: >
Checking if obtaining the prototype property of
Object.prototype.hasOwnProperty fails
---*/
//CHECK#1
if (Object.prototype.hasOwnProperty.prototype !== undefined) {
throw new Test262Error('#1: Object.prototype.hasOwnProperty has not prototype property' + Object.prototype.hasOwnProperty.prototype);
}
//
assert.sameValue(
Object.prototype.hasOwnProperty.prototype,
undefined,
'The value of Object.prototype.hasOwnProperty.prototype is expected to equal undefined'
);

View File

@ -7,8 +7,6 @@ es5id: 15.2.4.5_A7
description: Checking if creating "new Object.prototype.hasOwnProperty" fails
---*/
var FACTORY = Object.prototype.hasOwnProperty;
assert.throws(TypeError, function() {
new FACTORY;
});
new Object.prototype.hasOwnProperty();
}, '`new Object.prototype.hasOwnProperty()` throws a TypeError exception');

View File

@ -11,11 +11,10 @@ description: >
Object.prototype.propertyIsEnumerable.length property fails
includes: [propertyHelper.js]
---*/
//CHECK#1
if (!(Object.prototype.propertyIsEnumerable.hasOwnProperty('length'))) {
throw new Test262Error('#1: the Object.prototype.propertyIsEnumerable has length property');
}
assert(
!!Object.prototype.propertyIsEnumerable.hasOwnProperty('length'),
'The value of !!Object.prototype.propertyIsEnumerable.hasOwnProperty("length") is expected to be true'
);
var obj = Object.prototype.propertyIsEnumerable.length;
@ -23,7 +22,10 @@ verifyNotWritable(Object.prototype.propertyIsEnumerable, "length", null, functio
return "shifted";
});
//CHECK#2
if (Object.prototype.propertyIsEnumerable.length !== obj) {
throw new Test262Error('#2: the Object.prototype.propertyIsEnumerable length property has the attributes ReadOnly');
}
assert.sameValue(
Object.prototype.propertyIsEnumerable.length,
obj,
'The value of Object.prototype.propertyIsEnumerable.length is expected to equal the value of obj'
);
// TODO: Convert to verifyProperty() format.

View File

@ -6,13 +6,13 @@ info: The length property of the hasOwnProperty method is 1
es5id: 15.2.4.7_A11
description: Checking the value of Object.prototype.hasOwnProperty.length
---*/
assert(
!!Object.prototype.propertyIsEnumerable.hasOwnProperty("length"),
'The value of !!Object.prototype.propertyIsEnumerable.hasOwnProperty("length") is expected to be true'
);
//CHECK#1
if (!(Object.prototype.propertyIsEnumerable.hasOwnProperty("length"))) {
throw new Test262Error('#1: the Object.prototype.propertyIsEnumerable has length property');
}
//CHECK#2
if (Object.prototype.propertyIsEnumerable.length !== 1) {
throw new Test262Error('#2: The length property of the toObject method is 1');
}
assert.sameValue(
Object.prototype.propertyIsEnumerable.length,
1,
'The value of Object.prototype.propertyIsEnumerable.length is expected to be 1'
);

View File

@ -10,4 +10,4 @@ description: >
assert.throws(TypeError, function() {
Object.prototype.propertyIsEnumerable.call(undefined, 'foo');
});
}, 'Object.prototype.propertyIsEnumerable.call(undefined, "foo") throws a TypeError exception');

View File

@ -10,4 +10,4 @@ description: >
assert.throws(TypeError, function() {
Object.prototype.propertyIsEnumerable.call(null, 'foo');
});
}, 'Object.prototype.propertyIsEnumerable.call(null, "foo") throws a TypeError exception');

View File

@ -10,11 +10,11 @@ description: >
Calling the propertyIsEnumerable method for object in the
prototype chain
---*/
//CHECK#1
if (typeof Object.prototype.propertyIsEnumerable !== "function") {
throw new Test262Error('#1: propertyIsEnumerable method is defined');
}
assert.sameValue(
typeof Object.prototype.propertyIsEnumerable,
"function",
'The value of `typeof Object.prototype.propertyIsEnumerable` is expected to be "function"'
);
var proto = {
rootprop: "avis"
@ -22,24 +22,24 @@ var proto = {
function AVISFACTORY(name) {
this.name = name
};
}
AVISFACTORY.prototype = proto;
var seagull = new AVISFACTORY("seagull");
//CHECK#2
if (typeof seagull.propertyIsEnumerable !== "function") {
throw new Test262Error('#2: propertyIsEnumerable method is accessed');
}
assert.sameValue(
typeof seagull.propertyIsEnumerable,
"function",
'The value of `typeof seagull.propertyIsEnumerable` is expected to be "function"'
);
//CHECK#3
if (!(seagull.propertyIsEnumerable("name"))) {
throw new Test262Error('#3: propertyIsEnumerable method works properly');
}
assert(
!!seagull.propertyIsEnumerable("name"),
'The value of !!seagull.propertyIsEnumerable("name") is expected to be true'
);
//CHECK#4
if (seagull.propertyIsEnumerable("rootprop")) {
throw new Test262Error('#4: propertyIsEnumerable method does not consider objects in the prototype chain');
}
//
assert(
!seagull.propertyIsEnumerable("rootprop"),
'The value of !seagull.propertyIsEnumerable("rootprop") is expected to be true'
);

View File

@ -14,14 +14,15 @@ description: >
Checking the type of Object.prototype.propertyIsEnumerable and the
returned result
---*/
assert.sameValue(
typeof Object.prototype.propertyIsEnumerable,
"function",
'The value of `typeof Object.prototype.propertyIsEnumerable` is expected to be "function"'
);
//CHECK#1
if (typeof Object.prototype.propertyIsEnumerable !== "function") {
throw new Test262Error('#1: hasOwnProperty method is defined');
}
assert(
!Object.prototype.propertyIsEnumerable("propertyIsEnumerable"),
'The value of !Object.prototype.propertyIsEnumerable("propertyIsEnumerable") is expected to be true'
);
//CHECK#2
if (Object.prototype.propertyIsEnumerable("propertyIsEnumerable")) {
throw new Test262Error('#2: hasOwnProperty method works properly');
}
//
// TODO: Convert to verifyProperty() format.

View File

@ -14,32 +14,31 @@ description: >
Argument of the propertyIsEnumerable method is a custom boolean
property
---*/
//CHECK#1
if (typeof Object.prototype.propertyIsEnumerable !== "function") {
throw new Test262Error('#1: propertyIsEnumerable method is defined');
}
assert.sameValue(
typeof Object.prototype.propertyIsEnumerable,
"function",
'The value of `typeof Object.prototype.propertyIsEnumerable` is expected to be "function"'
);
var obj = {
the_property: true
};
//CHECK#2
if (typeof obj.propertyIsEnumerable !== "function") {
throw new Test262Error('#2: propertyIsEnumerable method is accessed');
}
assert.sameValue(
typeof obj.propertyIsEnumerable,
"function",
'The value of `typeof obj.propertyIsEnumerable` is expected to be "function"'
);
//CHECK#3
if (!(obj.propertyIsEnumerable("the_property"))) {
throw new Test262Error('#3: propertyIsEnumerable method works properly');
}
assert(
!!obj.propertyIsEnumerable("the_property"),
'The value of !!obj.propertyIsEnumerable("the_property") is expected to be true'
);
//CHECK#4
var accum = "";
for (var prop in obj) {
accum += prop;
}
if (accum.indexOf("the_property") !== 0) {
throw new Test262Error('#4: enumerating works properly');
}
//
assert.sameValue(accum.indexOf("the_property"), 0, 'accum.indexOf("the_property") must return 0');
// TODO: Convert to verifyProperty() format.

View File

@ -8,9 +8,8 @@ description: >
Checking if obtaining the prototype property of
Object.prototype.propertyIsEnumerable fails
---*/
//CHECK#1
if (Object.prototype.propertyIsEnumerable.prototype !== undefined) {
throw new Test262Error('#1: Object.prototype.propertyIsEnumerable has not prototype property' + Object.prototype.propertyIsEnumerable.prototype);
}
//
assert.sameValue(
Object.prototype.propertyIsEnumerable.prototype,
undefined,
'The value of Object.prototype.propertyIsEnumerable.prototype is expected to equal undefined'
);

View File

@ -9,8 +9,6 @@ description: >
fails
---*/
var FACTORY = Object.prototype.propertyIsEnumerable;
assert.throws(TypeError, function() {
new FACTORY;
});
new Object.prototype.propertyIsEnumerable();
}, '`new Object.prototype.propertyIsEnumerable()` throws a TypeError exception');

View File

@ -10,21 +10,19 @@ description: >
Checking if enumerating the
Object.prototype.propertyIsEnumerable.length property fails
---*/
assert(
!!Object.prototype.propertyIsEnumerable.hasOwnProperty('length'),
'The value of !!Object.prototype.propertyIsEnumerable.hasOwnProperty("length") is expected to be true'
);
//CHECK#0
if (!(Object.prototype.propertyIsEnumerable.hasOwnProperty('length'))) {
throw new Test262Error('#0: the Object.prototype.propertyIsEnumerable has length property');
}
assert(
!Object.prototype.propertyIsEnumerable.propertyIsEnumerable('length'),
'The value of !Object.prototype.propertyIsEnumerable.propertyIsEnumerable("length") is expected to be true'
);
// CHECK#1
if (Object.prototype.propertyIsEnumerable.propertyIsEnumerable('length')) {
throw new Test262Error('#1: the Object.prototype.propertyIsEnumerable.length property has the attributes DontEnum');
}
// CHECK#2
for (var p in Object.prototype.propertyIsEnumerable) {
if (p === "length")
throw new Test262Error('#2: the Object.prototype.propertyIsEnumerable.length property has the attributes DontEnum');
assert.notSameValue(p, "length", 'The value of p is not "length"');
}
//
// TODO: Convert to verifyProperty() format.

View File

@ -10,14 +10,14 @@ description: >
Checking if deleting the
Object.prototype.propertyIsEnumerable.length property fails
---*/
assert(
!!Object.prototype.propertyIsEnumerable.hasOwnProperty('length'),
'The value of !!Object.prototype.propertyIsEnumerable.hasOwnProperty("length") is expected to be true'
);
//CHECK#0
if (!(Object.prototype.propertyIsEnumerable.hasOwnProperty('length'))) {
throw new Test262Error('#0: the Object.prototype.propertyIsEnumerable has length property');
}
assert(
!!delete Object.prototype.propertyIsEnumerable.length,
'The value of !!delete Object.prototype.propertyIsEnumerable.length is expected to be true'
);
//CHECK#1
if (!delete Object.prototype.propertyIsEnumerable.length) {
throw new Test262Error('#1: The Object.prototype.propertyIsEnumerable.length property does not have the attributes DontDelete');
}
//
// TODO: Convert to verifyProperty() format.

View File

@ -8,18 +8,20 @@ description: >
Checking the type of Object.prototype.toLocaleString and the
returned result
---*/
assert.sameValue(
typeof Object.prototype.toLocaleString,
"function",
'The value of `typeof Object.prototype.toLocaleString` is expected to be "function"'
);
//CHECK#1
if (typeof Object.prototype.toLocaleString !== "function") {
throw new Test262Error('#1: toLocaleString method defined');
}
assert.sameValue(
Object.prototype.toLocaleString(),
Object.prototype.toString(),
'Object.prototype.toLocaleString() must return the same value returned by Object.prototype.toString()'
);
//CHECK#2
if (Object.prototype.toLocaleString() !== Object.prototype.toString()) {
throw new Test262Error('#1: toLocaleString function returns the result of calling toString()');
}
//CHECK#2
if ({}.toLocaleString() !== {}.toString()) {
throw new Test262Error('#2: toLocaleString function returns the result of calling toString()');
}
assert.sameValue(
{}.toLocaleString(),
{}.toString(),
'({}).toLocaleString() must return the same value returned by ({}).toString()'
);

View File

@ -11,11 +11,10 @@ description: >
property fails
includes: [propertyHelper.js]
---*/
//CHECK#1
if (!(Object.prototype.toLocaleString.hasOwnProperty('length'))) {
throw new Test262Error('#1: the Object.prototype.toLocaleString has length property.');
}
assert(
!!Object.prototype.toLocaleString.hasOwnProperty('length'),
'The value of !!Object.prototype.toLocaleString.hasOwnProperty("length") is expected to be true'
);
var obj = Object.prototype.toLocaleString.length;
@ -23,7 +22,10 @@ verifyNotWritable(Object.prototype.toLocaleString, "length", null, function() {
return "shifted";
});
//CHECK#2
if (Object.prototype.toLocaleString.length !== obj) {
throw new Test262Error('#2: the Object.prototype.toLocaleString length property has the attributes ReadOnly.');
}
assert.sameValue(
Object.prototype.toLocaleString.length,
obj,
'The value of Object.prototype.toLocaleString.length is expected to equal the value of obj'
);
// TODO: Convert to verifyProperty() format.

View File

@ -6,13 +6,13 @@ info: The length property of the toLocaleString method is 0
es5id: 15.2.4.3_A11
description: Checking the Object.prototype.toLocaleString.length
---*/
assert(
!!Object.prototype.toLocaleString.hasOwnProperty("length"),
'The value of !!Object.prototype.toLocaleString.hasOwnProperty("length") is expected to be true'
);
//CHECK#1
if (!(Object.prototype.toLocaleString.hasOwnProperty("length"))) {
throw new Test262Error('#1: The length property of the toLocaleString method is 0');
}
//CHECK#2
if (Object.prototype.toLocaleString.length !== 0) {
throw new Test262Error('#2: The length property of the toLocaleString method is 0');
}
assert.sameValue(
Object.prototype.toLocaleString.length,
0,
'The value of Object.prototype.toLocaleString.length is expected to be 0'
);

View File

@ -10,4 +10,4 @@ description: >
assert.throws(TypeError, function() {
Object.prototype.toLocaleString.call(undefined);
});
}, 'Object.prototype.toLocaleString.call(undefined) throws a TypeError exception');

View File

@ -10,4 +10,4 @@ description: >
assert.throws(TypeError, function() {
Object.prototype.toLocaleString.call(null);
});
}, 'Object.prototype.toLocaleString.call(null) throws a TypeError exception');

View File

@ -8,9 +8,8 @@ description: >
Checking if obtaining the prototype property of
Object.prototype.toLocaleString fails
---*/
//CHECK#1
if (Object.prototype.toLocaleString.prototype !== undefined) {
throw new Test262Error('#1: Object.prototype.toLocaleString has not prototype property' + Object.prototype.toLocaleString.prototype);
}
//
assert.sameValue(
Object.prototype.toLocaleString.prototype,
undefined,
'The value of Object.prototype.toLocaleString.prototype is expected to equal undefined'
);

View File

@ -7,8 +7,6 @@ es5id: 15.2.4.3_A7
description: Checking if creating "new Object.prototype.toLocaleString" fails
---*/
var FACTORY = Object.prototype.toLocaleString;
assert.throws(TypeError, function() {
new FACTORY;
});
new Object.prototype.toLocaleString();
}, '`new Object.prototype.toLocaleString()` throws a TypeError exception');

View File

@ -10,21 +10,19 @@ description: >
Checking if enumerating the Object.prototype.toLocaleString.length
property fails
---*/
assert(
!!Object.prototype.toLocaleString.hasOwnProperty('length'),
'The value of !!Object.prototype.toLocaleString.hasOwnProperty("length") is expected to be true'
);
//CHECK#0
if (!(Object.prototype.toLocaleString.hasOwnProperty('length'))) {
throw new Test262Error('#0: the Object.prototype.toLocaleString has length property.');
}
assert(
!Object.prototype.toLocaleString.propertyIsEnumerable('length'),
'The value of !Object.prototype.toLocaleString.propertyIsEnumerable("length") is expected to be true'
);
// CHECK#1
if (Object.prototype.toLocaleString.propertyIsEnumerable('length')) {
throw new Test262Error('#1: the Object.prototype.toLocaleString.length property has the attributes DontEnum');
}
// CHECK#2
for (var p in Object.prototype.toLocaleString) {
if (p === "length")
throw new Test262Error('#2: the Object.prototype.toLocaleString.length property has the attributes DontEnum');
assert.notSameValue(p, "length", 'The value of p is not "length"');
}
//
// TODO: Convert to verifyProperty() format.

View File

@ -10,18 +10,19 @@ description: >
Checknig if deleting of the Object.prototype.toLocaleString.length
property fails
---*/
assert(
!!Object.prototype.toLocaleString.hasOwnProperty('length'),
'The value of !!Object.prototype.toLocaleString.hasOwnProperty("length") is expected to be true'
);
//CHECK#0
if (!(Object.prototype.toLocaleString.hasOwnProperty('length'))) {
throw new Test262Error('#0: the Object.prototype.toLocaleString has length property');
}
assert(
!!delete Object.prototype.toLocaleString.length,
'The value of !!delete Object.prototype.toLocaleString.length is expected to be true'
);
//CHECK#1
if (!delete Object.prototype.toLocaleString.length) {
throw new Test262Error('#1: The Object.prototype.toLocaleString.length property does not have the attributes DontDelete');
}
assert(
!Object.prototype.toLocaleString.hasOwnProperty('length'),
'The value of !Object.prototype.toLocaleString.hasOwnProperty("length") is expected to be true'
);
//CHECK#2
if (Object.prototype.toLocaleString.hasOwnProperty('length')) {
throw new Test262Error('#2: The Object.prototype.toLocaleString.length property does not have the attributes DontDelete');
}
// TODO: Convert to verifyProperty() format.

View File

@ -9,11 +9,10 @@ description: >
fails
includes: [propertyHelper.js]
---*/
//CHECK#1
if (!(Object.prototype.valueOf.hasOwnProperty('length'))) {
throw new Test262Error('#1: the Object.prototype.valueOf has length property.');
}
assert(
!!Object.prototype.valueOf.hasOwnProperty('length'),
'The value of !!Object.prototype.valueOf.hasOwnProperty("length") is expected to be true'
);
var obj = Object.prototype.valueOf.length;
@ -21,7 +20,10 @@ verifyNotWritable(Object.prototype.valueOf, "length", null, function() {
return "shifted";
});
//CHECK#2
if (Object.prototype.valueOf.length !== obj) {
throw new Test262Error('#2: the Object.prototype.valueOf length property has the attributes ReadOnly.');
}
assert.sameValue(
Object.prototype.valueOf.length,
obj,
'The value of Object.prototype.valueOf.length is expected to equal the value of obj'
);
// TODO: Convert to verifyProperty() format.

View File

@ -6,13 +6,13 @@ info: The length property of the valueOf method is 0
es5id: 15.2.4.4_A11
description: Checking the Object.prototype.valueOf.length
---*/
assert(
!!Object.prototype.valueOf.hasOwnProperty("length"),
'The value of !!Object.prototype.valueOf.hasOwnProperty("length") is expected to be true'
);
//CHECK#1
if (!(Object.prototype.valueOf.hasOwnProperty("length"))) {
throw new Test262Error('#1: The length property of the toObject method is 0');
}
//CHECK#2
if (Object.prototype.valueOf.length !== 0) {
throw new Test262Error('#2: The length property of the toObject method is 0');
}
assert.sameValue(
Object.prototype.valueOf.length,
0,
'The value of Object.prototype.valueOf.length is expected to be 0'
);

View File

@ -11,4 +11,4 @@ description: Checking Object.prototype.valueOf invoked by the 'call' property.
assert.throws(TypeError, function() {
Object.prototype.valueOf.call(undefined);
});
}, 'Object.prototype.valueOf.call(undefined) throws a TypeError exception');

Some files were not shown because too many files have changed in this diff Show More