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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -11,17 +11,9 @@ description: Creating an object with "Object(1,2,3)"
var obj = Object(1, 2, 3); var obj = Object(1, 2, 3);
//CHECK#1 assert.sameValue(obj.constructor, Number, 'The value of obj.constructor is expected to equal the value of Number');
if (obj.constructor !== Number) { assert.sameValue(typeof obj, "object", 'The value of `typeof obj` is expected to be "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 assert(obj == 1, 'The result of evaluating (obj == 1) is expected to be true');
if (typeof obj !== "object") { assert.notSameValue(obj, 1, 'The value of obj is not 1');
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 "Object(null,2,3)"
var obj = Object(null, 2, 3); var obj = Object(null, 2, 3);
//CHECK#1 assert.sameValue(obj.constructor, Object, 'The value of obj.constructor is expected to equal the value of Object');
if (obj.constructor !== Object) { assert.sameValue(typeof obj, "object", 'The value of `typeof obj` is expected to be "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;');
}

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); var obj = Object((null, 2, 3), 1, 2);
//CHECK#1 assert.sameValue(obj.constructor, Number, 'The value of obj.constructor is expected to equal the value of Number');
if (obj.constructor !== Number) { assert.sameValue(typeof obj, "object", 'The value of `typeof obj` is expected to be "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 assert(obj == 3, 'The result of evaluating (obj == 3) is expected to be true');
if (typeof obj !== "object") { assert.notSameValue(obj, 3, 'The value of obj is not 3');
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;');
}

View File

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

View File

@ -15,12 +15,5 @@ var obj = {
var n_obj = new Object(obj); var n_obj = new Object(obj);
//CHECK#1 assert.sameValue(n_obj, obj, 'The value of n_obj is expected to equal the value of obj');
if (n_obj !== obj) { assert.sameValue(n_obj['prop'], 1, 'The value of n_obj["prop"] is expected to be 1');
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.');
}

View File

@ -15,13 +15,5 @@ var func = function() {
var n_obj = new Object(func); var n_obj = new Object(func);
//CHECK#1 assert.sameValue(n_obj, func, 'The value of n_obj is expected to equal the value of func');
if (n_obj !== func) { assert.sameValue(n_obj(), 1, 'n_obj() must return 1');
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');
}
//

View File

@ -15,12 +15,5 @@ var n_obj = new Object(arr);
arr.push(4); arr.push(4);
//CHECK#1 assert.sameValue(n_obj, arr, 'The value of n_obj is expected to equal the value of arr');
if (n_obj !== arr) { assert.sameValue(n_obj[3], 4, 'The value of n_obj[3] is expected to be 4');
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.');
}

View File

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

View File

@ -11,16 +11,9 @@ description: The value is a declared function
var n_obj = new Object(func); var n_obj = new Object(func);
//CHECK#1 assert.sameValue(n_obj, func, 'The value of n_obj is expected to equal the value of func');
if (n_obj !== func) { assert.sameValue(n_obj(), 1, 'n_obj() must return 1');
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');
}
function func() { function func() {
return 1; return 1;
}; }

View File

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

View File

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

View File

@ -11,29 +11,11 @@ description: Argument value is an empty string
var str = ''; var str = '';
//CHECK#1 assert.sameValue(typeof str, 'string', 'The value of `typeof str` is expected to be "string"');
if (typeof str !== 'string') {
throw new Test262Error('#1: "" is NOT a String');
}
var n_obj = new Object(str); var n_obj = new Object(str);
//CHECK#2 assert.sameValue(n_obj.constructor, String, 'The value of n_obj.constructor is expected to equal the value of String');
if (n_obj.constructor !== String) { assert.sameValue(typeof n_obj, 'object', 'The value of `typeof n_obj` is expected to be "object"');
throw new Test262Error('#2: When the Object constructor is called with String argument return ToObject(string)'); 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`');
//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)');
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -11,19 +11,9 @@ description: Argument value is NaN
var num = NaN; var num = NaN;
//CHECK#1 assert.sameValue(typeof num, 'number', 'The value of `typeof num` is expected to be "number"');
if (typeof num !== 'number') {
throw new Test262Error('#1: NaN is NOT a number');
}
var n_obj = new Object(num); var n_obj = new Object(num);
//CHECK#2 assert.sameValue(n_obj.constructor, Number, 'The value of n_obj.constructor is expected to equal the value of Number');
if (n_obj.constructor !== Number) { assert.sameValue(typeof n_obj, 'object', 'The value of `typeof n_obj` is expected to be "object"');
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)');
}

View File

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

View File

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

View File

@ -11,17 +11,8 @@ description: Creating an object with "new Object(1,2,3)"
var obj = new Object(1, 2, 3); var obj = new Object(1, 2, 3);
//CHECK#1 assert.sameValue(obj.constructor, Number, 'The value of obj.constructor is expected to equal the value of Number');
if (obj.constructor !== Number) { assert.sameValue(typeof obj, "object", 'The value of `typeof obj` is expected to be "object"');
throw new Test262Error('#1: 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#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); var obj = new Object(null, 2, 3);
//CHECK#1 assert.sameValue(obj.constructor, Object, 'The value of obj.constructor is expected to equal the value of Object');
if (obj.constructor !== Object) { assert.sameValue(typeof obj, "object", 'The value of `typeof obj` is expected to be "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;');
}

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); var obj = new Object((null, 2, 3), 1, 2);
//CHECK#1 assert.sameValue(obj.constructor, Number, 'The value of obj.constructor is expected to equal the value of Number');
if (obj.constructor !== Number) { assert.sameValue(typeof obj, "object", 'The value of `typeof obj` is expected to be "object"');
throw new Test262Error('#1: 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#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;');
}

View File

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

View File

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

View File

@ -6,13 +6,9 @@ info: Object constructor has length property whose value is 1
es5id: 15.2.3_A3 es5id: 15.2.3_A3
description: Checking Object.length description: Checking Object.length
---*/ ---*/
assert(
!!Object.hasOwnProperty("length"),
'The value of !!Object.hasOwnProperty("length") is expected to be true'
);
//CHECK#1 assert.sameValue(Object.length, 1, 'The value of Object.length is expected to be 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');
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -9,4 +9,4 @@ esid: sec-object.assign
var target = new Object(); var target = new Object();
var result = Object.assign(target, undefined, null); 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 target = new Object();
var result = Object.assign(target, 123, true, Symbol('foo')); 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 target = new Object();
var result = Object.assign(target, "123"); var result = Object.assign(target, "123");
assert.sameValue(result[0], "1", "The value should be {\"0\":\"1\"}."); assert.sameValue(result[0], "1", 'The value of result[0] is expected to be "1"');
assert.sameValue(result[1], "2", "The value should be {\"1\":\"2\"}."); assert.sameValue(result[1], "2", 'The value of result[1] is expected to be "2"');
assert.sameValue(result[2], "3", "The value should be {\"2\":\"3\"}."); 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) { if (!refused) {
var desc = Object.getOwnPropertyDescriptor(f, 'foo'); var desc = Object.getOwnPropertyDescriptor(f, 'foo');
if (desc.get !== getter) { assert.sameValue(desc.get, getter, 'The value of desc.get is expected to equal the value of getter');
throw new Test262Error('Getter on HTMLFormElement disappears');
}
} }
} }

View File

@ -17,6 +17,8 @@ function getter() {
Object.defineProperty(base, 'foo', { Object.defineProperty(base, 'foo', {
get: getter 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); var names = Object.getOwnPropertyNames(foo);
for (var i = 0, len = names.length; i < len; i++) { for (var i = 0, len = names.length; i < len; i++) {
if (!foo.hasOwnProperty(names[i])) { assert(!!foo.hasOwnProperty(names[i]), 'The value of !!foo.hasOwnProperty(names[i]) is expected to be true');
throw new Test262Error('Phantom own property: ' + names[i]);
}
} }

View File

@ -13,15 +13,15 @@ verifyNotWritable(Object, "prototype", null, function() {
return "shifted"; return "shifted";
}); });
//CHECK#1 assert.sameValue(Object.prototype, obj, 'The value of Object.prototype is expected to equal the value of obj');
if (Object.prototype !== obj) {
throw new Test262Error('#1: the Object.prototype property has the attributes ReadOnly.');
}
//CHECK#2
try { try {
Object.prototype(); Object.prototype();
throw new Test262Error('#2: the Object.prototype property has the attributes ReadOnly'); throw new Test262Error('#2: the Object.prototype property has the attributes ReadOnly');
} catch (e) { } 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 es5id: 15.2.3.1_A2
description: Checking if enumerating "Object.prototype" property fails 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; var cout = 0;
for (var p in Object) { for (var p in Object) {
if (p === "prototype") cout++; if (p === "prototype") {
cout++;
}
} }
if (cout !== 0) { assert.sameValue(cout, 0, 'The value of cout is expected to be 0');
throw new Test262Error('#2: the Object.prototype property has the attributes DontEnum');
} // TODO: Convert to verifyProperty() format.

View File

@ -9,17 +9,17 @@ includes: [propertyHelper.js]
verifyNotConfigurable(Object, "prototype"); verifyNotConfigurable(Object, "prototype");
//CHECK#1
try { try {
if ((delete Object.prototype) !== false) { assert.sameValue(delete Object.prototype, false, 'The value of `delete Object.prototype` is expected to be false');
throw new Test262Error('#1: Object.prototype has the attribute DontDelete');
}
} catch (e) { } catch (e) {
if (e instanceof Test262Error) throw e; if (e instanceof Test262Error) {
assert(e instanceof TypeError); throw e;
}
assert(e instanceof TypeError, 'The result of evaluating (e instanceof TypeError) is expected to be true');
} }
//CHECK#2
if (!(Object.hasOwnProperty('prototype'))) { if (!(Object.hasOwnProperty('prototype'))) {
throw new Test262Error('#2: the Object.prototype property has the attributes DontDelete.'); 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 es5id: 15.2.4_A1_T1
description: Checking if obtaining Object.prototype.prototype fails description: Checking if obtaining Object.prototype.prototype fails
---*/ ---*/
assert.sameValue(
// CHECK#1 Object.prototype.prototype,
if (Object.prototype.prototype !== undefined) { undefined,
throw new Test262Error('#1: Object prototype has not prototype'); '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 Since the Object prototype object has not prototype, deleted
toString method can not be found in prototype chain toString method can not be found in prototype chain
---*/ ---*/
assert.notSameValue(Object.prototype.toString(), false, 'Object.prototype.toString() must return false');
//CHECK#1
if (Object.prototype.toString() == false) {
throw new Test262Error('#1: Object prototype object has not prototype');
}
delete Object.prototype.toString; delete Object.prototype.toString;
// CHECK#2
try { try {
Object.prototype.toString(); Object.prototype.toString();
throw new Test262Error('#2: Object prototype object has not prototype'); throw new Test262Error('#2: Object prototype object has not prototype');
} catch (e) { } catch (e) {
if ((e instanceof TypeError) !== true) { assert.sameValue(
throw new Test262Error('#1.1: delete Object.prototype.toString; Object.prototype.toString() throw a TypeError. Actual: ' + (e)); 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(); var tostr = Object.prototype.toString();
//CHECK#1 assert.sameValue(tostr, "[object Object]", 'The value of tostr is expected to be "[object Object]"');
if (tostr !== "[object Object]") {
throw new Test262Error('#1: the value of the internal [[Class]] property of Object prototype object is "Object"');
}

View File

@ -11,4 +11,4 @@ description: Checking if calling Object prototype as a function fails
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
Object.prototype(); 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() { assert.throws(TypeError, function() {
new Object.prototype; new Object.prototype;
}); }, '`new Object.prototype` throws a TypeError exception');

View File

@ -8,8 +8,8 @@ info: |
es5id: 15.2.4.1_A1_T1 es5id: 15.2.4.1_A1_T1
description: Checking the Object.prototype.constructor description: Checking the Object.prototype.constructor
---*/ ---*/
assert.sameValue(
//CHECK#1 Object.prototype.constructor,
if (Object.prototype.constructor !== Object) { Object,
throw new Test262Error('#1: The initial value of Object.prototype.constructor is the built-in Object constructor'); '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; var obj = new constr;
// CHECK#0 assert.notSameValue(obj, undefined, 'The value of obj is expected to not equal ``undefined``');
if (obj === undefined) { assert.sameValue(obj.constructor, Object, 'The value of obj.constructor is expected to equal the value of Object');
throw new Test262Error('#0: new Object() return the newly created native object.');
}
// CHECK#1 assert(
if (obj.constructor !== Object) { !!Object.prototype.isPrototypeOf(obj),
throw new Test262Error('#1: new Object() create a new native ECMAScript object'); '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' + ']'; var to_string_result = '[object ' + 'Object' + ']';
if (obj.toString() !== to_string_result) { assert.sameValue(obj.toString(), to_string_result, 'obj.toString() returns 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.valueOf().toString(), to_string_result, 'obj.valueOf().toString() returns to_string_result');
}
// 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.');
}

View File

@ -10,4 +10,4 @@ description: >
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
Object.prototype.hasOwnProperty.call(undefined, 'foo'); 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() { assert.throws(TypeError, function() {
Object.prototype.hasOwnProperty.call(null, 'foo'); 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 Checking type of the Object.prototype.hasOwnProperty and the
returned result returned result
---*/ ---*/
assert.sameValue(
typeof Object.prototype.hasOwnProperty,
"function",
'The value of `typeof Object.prototype.hasOwnProperty` is expected to be "function"'
);
//CHECK#1 assert(
if (typeof Object.prototype.hasOwnProperty !== "function") { !!Object.prototype.hasOwnProperty("hasOwnProperty"),
throw new Test262Error('#1: hasOwnProperty method is defined'); 'The value of !!Object.prototype.hasOwnProperty("hasOwnProperty") is expected to be true'
} );
//CHECK#2
if (!(Object.prototype.hasOwnProperty("hasOwnProperty"))) {
throw new Test262Error('#2: hasOwnProperty method works properly');
}
//

View File

@ -11,28 +11,28 @@ info: |
es5id: 15.2.4.5_A1_T2 es5id: 15.2.4.5_A1_T2
description: Argument of the hasOwnProperty method is a custom boolean property description: Argument of the hasOwnProperty method is a custom boolean property
---*/ ---*/
assert.sameValue(
//CHECK#1 typeof Object.prototype.hasOwnProperty,
if (typeof Object.prototype.hasOwnProperty !== "function") { "function",
throw new Test262Error('#1: hasOwnProperty method is defined'); 'The value of `typeof Object.prototype.hasOwnProperty` is expected to be "function"'
} );
var obj = { var obj = {
the_property: true the_property: true
}; };
//CHECK#2 assert.sameValue(
if (typeof obj.hasOwnProperty !== "function") { typeof obj.hasOwnProperty,
throw new Test262Error('#2: hasOwnProperty method is accessed'); "function",
} 'The value of `typeof obj.hasOwnProperty` is expected to be "function"'
);
//CHECK#3 assert(
if (obj.hasOwnProperty("hasOwnProperty")) { !obj.hasOwnProperty("hasOwnProperty"),
throw new Test262Error('#3: hasOwnProperty method works properly'); 'The value of !obj.hasOwnProperty("hasOwnProperty") is expected to be true'
} );
//CHECK#4 assert(
if (!(obj.hasOwnProperty("the_property"))) { !!obj.hasOwnProperty("the_property"),
throw new Test262Error('#4: hasOwnProperty method works properly'); '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; var instance = new FACTORY;
//CHECK#1 assert.sameValue(
if (typeof Object.prototype.hasOwnProperty !== "function") { typeof Object.prototype.hasOwnProperty,
throw new Test262Error('#1: hasOwnProperty method is defined'); "function",
} 'The value of `typeof Object.prototype.hasOwnProperty` is expected to be "function"'
);
//CHECK#2 assert.sameValue(
if (typeof instance.hasOwnProperty !== "function") { typeof instance.hasOwnProperty,
throw new Test262Error('#2: hasOwnProperty method is accessed'); "function",
} 'The value of `typeof instance.hasOwnProperty` is expected to be "function"'
);
//CHECK#3 assert(
if (instance.hasOwnProperty("toString")) { !instance.hasOwnProperty("toString"),
throw new Test262Error('#3: hasOwnProperty method works properly'); 'The value of !instance.hasOwnProperty("toString") is expected to be true'
} );
//CHECK#4 assert(
if (!(instance.hasOwnProperty("aproperty"))) { !!instance.hasOwnProperty("aproperty"),
throw new Test262Error('#4: hasOwnProperty method works properly'); '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 Checking if obtaining the prototype property of
Object.prototype.hasOwnProperty fails Object.prototype.hasOwnProperty fails
---*/ ---*/
assert.sameValue(
//CHECK#1 Object.prototype.hasOwnProperty.prototype,
if (Object.prototype.hasOwnProperty.prototype !== undefined) { undefined,
throw new Test262Error('#1: Object.prototype.hasOwnProperty has not prototype property' + Object.prototype.hasOwnProperty.prototype); '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 description: Checking if creating "new Object.prototype.hasOwnProperty" fails
---*/ ---*/
var FACTORY = Object.prototype.hasOwnProperty;
assert.throws(TypeError, function() { 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 Object.prototype.propertyIsEnumerable.length property fails
includes: [propertyHelper.js] includes: [propertyHelper.js]
---*/ ---*/
assert(
//CHECK#1 !!Object.prototype.propertyIsEnumerable.hasOwnProperty('length'),
if (!(Object.prototype.propertyIsEnumerable.hasOwnProperty('length'))) { 'The value of !!Object.prototype.propertyIsEnumerable.hasOwnProperty("length") is expected to be true'
throw new Test262Error('#1: the Object.prototype.propertyIsEnumerable has length property'); );
}
var obj = Object.prototype.propertyIsEnumerable.length; var obj = Object.prototype.propertyIsEnumerable.length;
@ -23,7 +22,10 @@ verifyNotWritable(Object.prototype.propertyIsEnumerable, "length", null, functio
return "shifted"; return "shifted";
}); });
//CHECK#2 assert.sameValue(
if (Object.prototype.propertyIsEnumerable.length !== obj) { Object.prototype.propertyIsEnumerable.length,
throw new Test262Error('#2: the Object.prototype.propertyIsEnumerable length property has the attributes ReadOnly'); 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 es5id: 15.2.4.7_A11
description: Checking the value of Object.prototype.hasOwnProperty.length 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 assert.sameValue(
if (!(Object.prototype.propertyIsEnumerable.hasOwnProperty("length"))) { Object.prototype.propertyIsEnumerable.length,
throw new Test262Error('#1: the Object.prototype.propertyIsEnumerable has length property'); 1,
} 'The value of Object.prototype.propertyIsEnumerable.length is expected to be 1'
);
//CHECK#2
if (Object.prototype.propertyIsEnumerable.length !== 1) {
throw new Test262Error('#2: The length property of the toObject method is 1');
}

View File

@ -10,4 +10,4 @@ description: >
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
Object.prototype.propertyIsEnumerable.call(undefined, 'foo'); 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() { assert.throws(TypeError, function() {
Object.prototype.propertyIsEnumerable.call(null, 'foo'); 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 Calling the propertyIsEnumerable method for object in the
prototype chain prototype chain
---*/ ---*/
assert.sameValue(
//CHECK#1 typeof Object.prototype.propertyIsEnumerable,
if (typeof Object.prototype.propertyIsEnumerable !== "function") { "function",
throw new Test262Error('#1: propertyIsEnumerable method is defined'); 'The value of `typeof Object.prototype.propertyIsEnumerable` is expected to be "function"'
} );
var proto = { var proto = {
rootprop: "avis" rootprop: "avis"
@ -22,24 +22,24 @@ var proto = {
function AVISFACTORY(name) { function AVISFACTORY(name) {
this.name = name this.name = name
}; }
AVISFACTORY.prototype = proto; AVISFACTORY.prototype = proto;
var seagull = new AVISFACTORY("seagull"); var seagull = new AVISFACTORY("seagull");
//CHECK#2 assert.sameValue(
if (typeof seagull.propertyIsEnumerable !== "function") { typeof seagull.propertyIsEnumerable,
throw new Test262Error('#2: propertyIsEnumerable method is accessed'); "function",
} 'The value of `typeof seagull.propertyIsEnumerable` is expected to be "function"'
);
//CHECK#3 assert(
if (!(seagull.propertyIsEnumerable("name"))) { !!seagull.propertyIsEnumerable("name"),
throw new Test262Error('#3: propertyIsEnumerable method works properly'); 'The value of !!seagull.propertyIsEnumerable("name") is expected to be true'
} );
//CHECK#4 assert(
if (seagull.propertyIsEnumerable("rootprop")) { !seagull.propertyIsEnumerable("rootprop"),
throw new Test262Error('#4: propertyIsEnumerable method does not consider objects in the prototype chain'); '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 Checking the type of Object.prototype.propertyIsEnumerable and the
returned result returned result
---*/ ---*/
assert.sameValue(
typeof Object.prototype.propertyIsEnumerable,
"function",
'The value of `typeof Object.prototype.propertyIsEnumerable` is expected to be "function"'
);
//CHECK#1 assert(
if (typeof Object.prototype.propertyIsEnumerable !== "function") { !Object.prototype.propertyIsEnumerable("propertyIsEnumerable"),
throw new Test262Error('#1: hasOwnProperty method is defined'); 'The value of !Object.prototype.propertyIsEnumerable("propertyIsEnumerable") is expected to be true'
} );
//CHECK#2 // TODO: Convert to verifyProperty() format.
if (Object.prototype.propertyIsEnumerable("propertyIsEnumerable")) {
throw new Test262Error('#2: hasOwnProperty method works properly');
}
//

View File

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

View File

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

View File

@ -9,8 +9,6 @@ description: >
fails fails
---*/ ---*/
var FACTORY = Object.prototype.propertyIsEnumerable;
assert.throws(TypeError, function() { 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 Checking if enumerating the
Object.prototype.propertyIsEnumerable.length property fails 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 assert(
if (!(Object.prototype.propertyIsEnumerable.hasOwnProperty('length'))) { !Object.prototype.propertyIsEnumerable.propertyIsEnumerable('length'),
throw new Test262Error('#0: the Object.prototype.propertyIsEnumerable has length property'); '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) { for (var p in Object.prototype.propertyIsEnumerable) {
if (p === "length") assert.notSameValue(p, "length", 'The value of p is not "length"');
throw new Test262Error('#2: the Object.prototype.propertyIsEnumerable.length property has the attributes DontEnum');
} }
// //
// TODO: Convert to verifyProperty() format.

View File

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

View File

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

View File

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

View File

@ -10,4 +10,4 @@ description: >
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
Object.prototype.toLocaleString.call(undefined); 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() { assert.throws(TypeError, function() {
Object.prototype.toLocaleString.call(null); 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 Checking if obtaining the prototype property of
Object.prototype.toLocaleString fails Object.prototype.toLocaleString fails
---*/ ---*/
assert.sameValue(
//CHECK#1 Object.prototype.toLocaleString.prototype,
if (Object.prototype.toLocaleString.prototype !== undefined) { undefined,
throw new Test262Error('#1: Object.prototype.toLocaleString has not prototype property' + Object.prototype.toLocaleString.prototype); '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 description: Checking if creating "new Object.prototype.toLocaleString" fails
---*/ ---*/
var FACTORY = Object.prototype.toLocaleString;
assert.throws(TypeError, function() { 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 Checking if enumerating the Object.prototype.toLocaleString.length
property fails property fails
---*/ ---*/
assert(
!!Object.prototype.toLocaleString.hasOwnProperty('length'),
'The value of !!Object.prototype.toLocaleString.hasOwnProperty("length") is expected to be true'
);
//CHECK#0 assert(
if (!(Object.prototype.toLocaleString.hasOwnProperty('length'))) { !Object.prototype.toLocaleString.propertyIsEnumerable('length'),
throw new Test262Error('#0: the Object.prototype.toLocaleString has length property.'); '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) { for (var p in Object.prototype.toLocaleString) {
if (p === "length") assert.notSameValue(p, "length", 'The value of p is not "length"');
throw new Test262Error('#2: the Object.prototype.toLocaleString.length property has the attributes DontEnum');
} }
// //
// TODO: Convert to verifyProperty() format.

View File

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

View File

@ -9,11 +9,10 @@ description: >
fails fails
includes: [propertyHelper.js] includes: [propertyHelper.js]
---*/ ---*/
assert(
//CHECK#1 !!Object.prototype.valueOf.hasOwnProperty('length'),
if (!(Object.prototype.valueOf.hasOwnProperty('length'))) { 'The value of !!Object.prototype.valueOf.hasOwnProperty("length") is expected to be true'
throw new Test262Error('#1: the Object.prototype.valueOf has length property.'); );
}
var obj = Object.prototype.valueOf.length; var obj = Object.prototype.valueOf.length;
@ -21,7 +20,10 @@ verifyNotWritable(Object.prototype.valueOf, "length", null, function() {
return "shifted"; return "shifted";
}); });
//CHECK#2 assert.sameValue(
if (Object.prototype.valueOf.length !== obj) { Object.prototype.valueOf.length,
throw new Test262Error('#2: the Object.prototype.valueOf length property has the attributes ReadOnly.'); 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 es5id: 15.2.4.4_A11
description: Checking the Object.prototype.valueOf.length 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 assert.sameValue(
if (!(Object.prototype.valueOf.hasOwnProperty("length"))) { Object.prototype.valueOf.length,
throw new Test262Error('#1: The length property of the toObject method is 0'); 0,
} 'The value of Object.prototype.valueOf.length is expected to be 0'
);
//CHECK#2
if (Object.prototype.valueOf.length !== 0) {
throw new Test262Error('#2: The length property of the toObject method is 0');
}

View File

@ -11,4 +11,4 @@ description: Checking Object.prototype.valueOf invoked by the 'call' property.
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
Object.prototype.valueOf.call(undefined); 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