mirror of https://github.com/tc39/test262.git
built-ins/Object/*: make all indentation consistent (depth & character) (#1432)
This commit is contained in:
parent
dedd68020b
commit
a61b9cd671
|
@ -11,24 +11,24 @@ description: Creating Object(null) and checking its properties
|
|||
|
||||
var __obj = Object(null);
|
||||
|
||||
var n__obj = new Object(null);
|
||||
var n__obj = new Object(null);
|
||||
|
||||
if (__obj.toString() !== n__obj.toString()){
|
||||
$ERROR('#1');
|
||||
if (__obj.toString() !== n__obj.toString()) {
|
||||
$ERROR('#1');
|
||||
}
|
||||
|
||||
if (__obj.constructor !== n__obj.constructor) {
|
||||
$ERROR('#2');
|
||||
$ERROR('#2');
|
||||
}
|
||||
|
||||
if (__obj.prototype !== n__obj.prototype) {
|
||||
$ERROR('#3');
|
||||
}
|
||||
$ERROR('#3');
|
||||
}
|
||||
|
||||
if (__obj.toLocaleString() !== n__obj.toLocaleString()) {
|
||||
$ERROR('#4');
|
||||
$ERROR('#4');
|
||||
}
|
||||
|
||||
if (typeof __obj !== typeof n__obj) {
|
||||
$ERROR('#5');
|
||||
$ERROR('#5');
|
||||
}
|
||||
|
|
|
@ -16,22 +16,22 @@ var __obj = Object(void 0);
|
|||
var n__obj = new Object(void 0);
|
||||
|
||||
|
||||
if (__obj.toString() !== n__obj.toString()){
|
||||
$ERROR('#1');
|
||||
if (__obj.toString() !== n__obj.toString()) {
|
||||
$ERROR('#1');
|
||||
}
|
||||
|
||||
if (__obj.constructor !== n__obj.constructor) {
|
||||
$ERROR('#2');
|
||||
$ERROR('#2');
|
||||
}
|
||||
|
||||
if (__obj.prototype !== n__obj.prototype) {
|
||||
$ERROR('#3');
|
||||
}
|
||||
$ERROR('#3');
|
||||
}
|
||||
|
||||
if (__obj.toLocaleString() !== n__obj.toLocaleString()) {
|
||||
$ERROR('#4');
|
||||
$ERROR('#4');
|
||||
}
|
||||
|
||||
if (typeof __obj !== typeof n__obj) {
|
||||
$ERROR('#5');
|
||||
$ERROR('#5');
|
||||
}
|
||||
|
|
|
@ -12,23 +12,23 @@ description: Creating Object() and checking its properties
|
|||
var __obj = Object();
|
||||
|
||||
var n__obj = new Object();
|
||||
|
||||
if (__obj.toString() !== n__obj.toString()){
|
||||
$ERROR('#1');
|
||||
|
||||
if (__obj.toString() !== n__obj.toString()) {
|
||||
$ERROR('#1');
|
||||
}
|
||||
|
||||
if (__obj.constructor !== n__obj.constructor) {
|
||||
$ERROR('#2');
|
||||
$ERROR('#2');
|
||||
}
|
||||
|
||||
if (__obj.prototype !== n__obj.prototype) {
|
||||
$ERROR('#3');
|
||||
}
|
||||
$ERROR('#3');
|
||||
}
|
||||
|
||||
if (__obj.toLocaleString() !== n__obj.toLocaleString()) {
|
||||
$ERROR('#4');
|
||||
$ERROR('#4');
|
||||
}
|
||||
|
||||
if (typeof __obj !== typeof n__obj) {
|
||||
$ERROR('#5');
|
||||
$ERROR('#5');
|
||||
}
|
||||
|
|
|
@ -11,24 +11,24 @@ description: Creating Object(undefined) and checking its properties
|
|||
|
||||
var __obj = Object(undefined);
|
||||
|
||||
var n__obj = new Object(undefined);
|
||||
var n__obj = new Object(undefined);
|
||||
|
||||
if (__obj.toString() !== n__obj.toString()){
|
||||
$ERROR('#1');
|
||||
if (__obj.toString() !== n__obj.toString()) {
|
||||
$ERROR('#1');
|
||||
}
|
||||
|
||||
if (__obj.constructor !== n__obj.constructor) {
|
||||
$ERROR('#2');
|
||||
$ERROR('#2');
|
||||
}
|
||||
|
||||
if (__obj.prototype !== n__obj.prototype) {
|
||||
$ERROR('#3');
|
||||
}
|
||||
$ERROR('#3');
|
||||
}
|
||||
|
||||
if (__obj.toLocaleString() !== n__obj.toLocaleString()) {
|
||||
$ERROR('#4');
|
||||
$ERROR('#4');
|
||||
}
|
||||
|
||||
if (typeof __obj !== typeof n__obj) {
|
||||
$ERROR('#5');
|
||||
$ERROR('#5');
|
||||
}
|
||||
|
|
|
@ -11,26 +11,26 @@ description: Creating Object(x) and checking its properties
|
|||
|
||||
var __obj = Object(x);
|
||||
|
||||
var n__obj = new Object(x);
|
||||
var n__obj = new Object(x);
|
||||
|
||||
if (__obj.toString() !== n__obj.toString()){
|
||||
$ERROR('#1');
|
||||
if (__obj.toString() !== n__obj.toString()) {
|
||||
$ERROR('#1');
|
||||
}
|
||||
|
||||
if (__obj.constructor !== n__obj.constructor) {
|
||||
$ERROR('#2');
|
||||
$ERROR('#2');
|
||||
}
|
||||
|
||||
if (__obj.prototype !== n__obj.prototype) {
|
||||
$ERROR('#3');
|
||||
}
|
||||
$ERROR('#3');
|
||||
}
|
||||
|
||||
if (__obj.toLocaleString() !== n__obj.toLocaleString()) {
|
||||
$ERROR('#4');
|
||||
$ERROR('#4');
|
||||
}
|
||||
|
||||
if (typeof __obj !== typeof n__obj) {
|
||||
$ERROR('#5');
|
||||
$ERROR('#5');
|
||||
}
|
||||
|
||||
var x;
|
||||
|
|
|
@ -11,7 +11,7 @@ description: Calling Object function with boolean argument value
|
|||
|
||||
var bool = true;
|
||||
|
||||
if(typeof bool !== 'boolean'){
|
||||
if (typeof bool !== 'boolean') {
|
||||
$ERROR('#1: bool should be boolean primitive');
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ es5id: 15.2.1.1_A2_T10
|
|||
description: Calling Object function with array of numbers as argument value
|
||||
---*/
|
||||
|
||||
var arr = [1,2,3];
|
||||
var arr = [1, 2, 3];
|
||||
|
||||
//CHECK#1
|
||||
if (typeof arr !== 'object') {
|
||||
|
@ -21,6 +21,6 @@ var n_obj = Object(arr);
|
|||
arr.push(4);
|
||||
|
||||
//CHECK#2
|
||||
if ((n_obj !== arr)||(n_obj[3]!==4)) {
|
||||
if ((n_obj !== arr) || (n_obj[3] !== 4)) {
|
||||
$ERROR('#2: Object([1,2,3]) returns ToObject([1,2,3])');
|
||||
}
|
||||
|
|
|
@ -14,10 +14,12 @@ if (typeof func !== 'undefined') {
|
|||
$ERROR('#1: function expression can\'t be declarated');
|
||||
}
|
||||
|
||||
var n_obj = Object(function func(){return 1;});
|
||||
var n_obj = Object(function func() {
|
||||
return 1;
|
||||
});
|
||||
|
||||
//CHECK#2
|
||||
if ((n_obj.constructor !== Function)||(n_obj()!==1)) {
|
||||
if ((n_obj.constructor !== Function) || (n_obj() !== 1)) {
|
||||
$ERROR('#2: Object(function func(){return 1;}) returns function');
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,9 @@ es5id: 15.2.1.1_A2_T12
|
|||
description: Calling Object function with numeric expression as argument value
|
||||
---*/
|
||||
|
||||
var obj = Object(1.1*([].length+{q:1}["q"]));
|
||||
var obj = Object(1.1 * ([].length + {
|
||||
q: 1
|
||||
}["q"]));
|
||||
|
||||
//CHECK#2
|
||||
if (typeof obj !== "object") {
|
||||
|
@ -22,7 +24,7 @@ if (obj.constructor !== Number) {
|
|||
}
|
||||
|
||||
//CHECK#4
|
||||
if ((obj != 1.1)||(obj === 1.1)) {
|
||||
if ((obj != 1.1) || (obj === 1.1)) {
|
||||
$ERROR('#4: Object(expression) returns ToObject(expression)');
|
||||
}
|
||||
//
|
||||
|
|
|
@ -9,7 +9,7 @@ es5id: 15.2.1.1_A2_T13
|
|||
description: Calling Object function with boolean expression as argument value
|
||||
---*/
|
||||
|
||||
var obj = Object((1===1)&&(!false));
|
||||
var obj = Object((1 === 1) && (!false));
|
||||
|
||||
//CHECK#1
|
||||
if (obj.constructor !== Boolean) {
|
||||
|
@ -27,6 +27,6 @@ if (!(obj)) {
|
|||
}
|
||||
|
||||
//CHECK#3
|
||||
if (obj===true) {
|
||||
if (obj === true) {
|
||||
$ERROR('#3: Object(expression) returns ToObject(expression)');
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ description: >
|
|||
argument value
|
||||
---*/
|
||||
|
||||
var obj = Object(""+1);
|
||||
var obj = Object("" + 1);
|
||||
|
||||
//CHECK#2
|
||||
if (obj.constructor !== String) {
|
||||
|
@ -24,6 +24,6 @@ if (typeof obj !== "object") {
|
|||
}
|
||||
|
||||
//CHECK#4
|
||||
if ((obj != "1")||(obj === "1")) {
|
||||
if ((obj != "1") || (obj === "1")) {
|
||||
$ERROR('#4: Object(expression) returns ToObject(expression)');
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ description: Calling Object function with number argument value
|
|||
var num = 1.1;
|
||||
|
||||
// CHECK#1
|
||||
if(typeof num !== 'number'){
|
||||
if (typeof num !== 'number') {
|
||||
$ERROR('#1: num = 1.1 should be Number primitive');
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ if (obj.constructor !== Number) {
|
|||
}
|
||||
|
||||
//CHECK#4
|
||||
if ((obj != 1.1)||(obj === 1.1)) {
|
||||
if ((obj != 1.1) || (obj === 1.1)) {
|
||||
$ERROR('#4: Object(1.1) returns ToObject(1.1)');
|
||||
}
|
||||
//
|
||||
|
|
|
@ -12,7 +12,7 @@ description: Calling Object function with string argument value
|
|||
var str = 'Luke Skywalker';
|
||||
|
||||
// CHECK#1
|
||||
if (typeof str !== 'string') {
|
||||
if (typeof str !== 'string') {
|
||||
$ERROR('#1: "Luke Skywalker" should be a String primitive');
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,6 @@ if (typeof obj !== "object") {
|
|||
}
|
||||
|
||||
//CHECK#4
|
||||
if ((obj != "Luke Skywalker")||(obj === "Luke Skywalker")) {
|
||||
if ((obj != "Luke Skywalker") || (obj === "Luke Skywalker")) {
|
||||
$ERROR('#4: Object("Luke Skywalker") returns ToObject("Luke Skywalker")');
|
||||
}
|
||||
|
|
|
@ -9,7 +9,9 @@ es5id: 15.2.1.1_A2_T4
|
|||
description: Calling Object function with object argument value
|
||||
---*/
|
||||
|
||||
var obj = {flag:true};
|
||||
var obj = {
|
||||
flag: true
|
||||
};
|
||||
|
||||
//CHECK#1
|
||||
if (typeof(obj) !== 'object') {
|
||||
|
@ -19,6 +21,6 @@ if (typeof(obj) !== 'object') {
|
|||
var n_obj = Object(obj);
|
||||
|
||||
//CHECK#2
|
||||
if ((n_obj !== obj)||(!(n_obj['flag']))) {
|
||||
if ((n_obj !== obj) || (!(n_obj['flag']))) {
|
||||
$ERROR('#2: Object({flag:true}) returns ToObject({flag:true})');
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ description: Calling Object function with NaN argument value
|
|||
var num = NaN;
|
||||
|
||||
// CHECK#1
|
||||
if(typeof num !== 'number'){
|
||||
if (typeof num !== 'number') {
|
||||
$ERROR('#1: num = NaN should have number type');
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ if (obj.constructor !== Number) {
|
|||
}
|
||||
|
||||
//CHECK#3
|
||||
if (typeof obj!=="object") {
|
||||
if (typeof obj !== "object") {
|
||||
$ERROR('#2: Object(NaN) returns ToObject(NaN)');
|
||||
}
|
||||
//
|
||||
|
|
|
@ -12,7 +12,7 @@ description: Calling Object function with Infinity argument value
|
|||
var num = Infinity;
|
||||
|
||||
// CHECK#1
|
||||
if(typeof num !== 'number'){
|
||||
if (typeof num !== 'number') {
|
||||
$ERROR('#1: num = Infinity should be a Number primitive');
|
||||
}
|
||||
|
||||
|
@ -24,11 +24,11 @@ if (obj.constructor !== Number) {
|
|||
}
|
||||
|
||||
//CHECK#3
|
||||
if (typeof obj!=="object") {
|
||||
if (typeof obj !== "object") {
|
||||
$ERROR('#3: Object(Infinity) returns ToObject(Infinity)');
|
||||
}
|
||||
|
||||
//CHECK#4
|
||||
if ((obj != Infinity)||(obj === Infinity)) {
|
||||
if ((obj != Infinity) || (obj === Infinity)) {
|
||||
$ERROR('#4: Object(Infinity) returns ToObject(Infinity)');
|
||||
}
|
||||
|
|
|
@ -29,6 +29,6 @@ if (typeof obj !== "object") {
|
|||
}
|
||||
|
||||
//CHECK#4
|
||||
if ((obj != "")||(obj === "")) {
|
||||
if ((obj != "") || (obj === "")) {
|
||||
$ERROR('#4: Object("") returns ToObject("")');
|
||||
}
|
||||
|
|
|
@ -9,7 +9,9 @@ es5id: 15.2.1.1_A2_T8
|
|||
description: Calling Object function with function variable argument value
|
||||
---*/
|
||||
|
||||
var func = function(){return 1;};
|
||||
var func = function() {
|
||||
return 1;
|
||||
};
|
||||
|
||||
//CHECK#1
|
||||
if (typeof func !== 'function') {
|
||||
|
@ -19,6 +21,6 @@ if (typeof func !== 'function') {
|
|||
var n_obj = Object(func);
|
||||
|
||||
//CHECK#2
|
||||
if ((n_obj !== func)||(n_obj()!==1)) {
|
||||
if ((n_obj !== func) || (n_obj() !== 1)) {
|
||||
$ERROR('#2: Object(function) returns function');
|
||||
}
|
||||
|
|
|
@ -19,8 +19,10 @@ if (typeof func !== 'function') {
|
|||
var n_obj = Object(func);
|
||||
|
||||
//CHECK#2
|
||||
if ((n_obj !== func)||(n_obj()!==1)) {
|
||||
if ((n_obj !== func) || (n_obj() !== 1)) {
|
||||
$ERROR('#2: Object(function) returns function');
|
||||
}
|
||||
|
||||
function func(){return 1;};
|
||||
function func() {
|
||||
return 1;
|
||||
};
|
||||
|
|
|
@ -9,7 +9,7 @@ es5id: 15.2.1.1_A3_T1
|
|||
description: Creating an object with "Object(1,2,3)"
|
||||
---*/
|
||||
|
||||
var obj = Object(1,2,3);
|
||||
var obj = Object(1, 2, 3);
|
||||
|
||||
//CHECK#1
|
||||
if (obj.constructor !== Number) {
|
||||
|
@ -22,6 +22,6 @@ if (typeof obj !== "object") {
|
|||
}
|
||||
|
||||
//CHECK#3
|
||||
if ((obj != 1)||(obj === 1)) {
|
||||
if ((obj != 1) || (obj === 1)) {
|
||||
$ERROR('3#: Since Object as a function calling is the same as function calling list of arguments can appears in braces;');
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ es5id: 15.2.1.1_A3_T2
|
|||
description: Creating an object with "Object(null,2,3)"
|
||||
---*/
|
||||
|
||||
var obj = Object(null,2,3);
|
||||
var obj = Object(null, 2, 3);
|
||||
|
||||
//CHECK#1
|
||||
if (obj.constructor !== Object) {
|
||||
|
|
|
@ -9,7 +9,7 @@ es5id: 15.2.1.1_A3_T3
|
|||
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
|
||||
if (obj.constructor !== Number) {
|
||||
|
@ -22,6 +22,6 @@ if (typeof obj !== "object") {
|
|||
}
|
||||
|
||||
//CHECK#3
|
||||
if ((obj != 3)||(obj === 3)) {
|
||||
if ((obj != 3) || (obj === 3)) {
|
||||
$ERROR('3#: Since Object as a function calling is the same as function calling list of arguments can appears in braces;');
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ if (!(Object.prototype.isPrototypeOf(obj))) {
|
|||
}
|
||||
|
||||
// CHECK#3
|
||||
var to_string_result = '[object '+ 'Object' +']';
|
||||
var to_string_result = '[object ' + 'Object' + ']';
|
||||
if (obj.toString() !== to_string_result) {
|
||||
$ERROR('#3: when new Object() calls the [[Class]] property of the newly constructed object is set to "Object".');
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ if (!(Object.prototype.isPrototypeOf(obj))) {
|
|||
}
|
||||
|
||||
// CHECK#3
|
||||
var to_string_result = '[object '+ 'Object' +']';
|
||||
var to_string_result = '[object ' + 'Object' + ']';
|
||||
if (obj.toString() !== to_string_result) {
|
||||
$ERROR('#3: when new Object(undefined) calls the [[Class]] property of the newly constructed object is set to "Object".');
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ if (!(Object.prototype.isPrototypeOf(obj))) {
|
|||
}
|
||||
|
||||
// CHECK#3
|
||||
var to_string_result = '[object '+ 'Object' +']';
|
||||
var to_string_result = '[object ' + 'Object' + ']';
|
||||
if (obj.toString() !== to_string_result) {
|
||||
$ERROR('#3: when new Object(null) calls the [[Class]] property of the newly constructed object is set to "Object".');
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ if (!(Object.prototype.isPrototypeOf(obj))) {
|
|||
}
|
||||
|
||||
// CHECK#3
|
||||
var to_string_result = '[object '+ 'Object' +']';
|
||||
var to_string_result = '[object ' + 'Object' + ']';
|
||||
if (obj.toString() !== to_string_result) {
|
||||
$ERROR('#3: when new Object(undefined) calls the [[Class]] property of the newly constructed object is set to "Object".');
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ if (!(Object.prototype.isPrototypeOf(obj))) {
|
|||
}
|
||||
|
||||
// CHECK#3
|
||||
var to_string_result = '[object '+ 'Object' +']';
|
||||
var to_string_result = '[object ' + 'Object' + ']';
|
||||
if (obj.toString() !== to_string_result) {
|
||||
$ERROR('#3: when new Object(undefined) calls the [[Class]] property of the newly constructed object is set to "Object".');
|
||||
}
|
||||
|
|
|
@ -9,7 +9,9 @@ es5id: 15.2.2.1_A2_T1
|
|||
description: The value is Object
|
||||
---*/
|
||||
|
||||
var obj = {prop:1};
|
||||
var obj = {
|
||||
prop: 1
|
||||
};
|
||||
|
||||
var n_obj = new Object(obj);
|
||||
|
||||
|
|
|
@ -9,7 +9,9 @@ es5id: 15.2.2.1_A2_T2
|
|||
description: The value is a function variable
|
||||
---*/
|
||||
|
||||
var func = function(){return 1;};
|
||||
var func = function() {
|
||||
return 1;
|
||||
};
|
||||
|
||||
var n_obj = new Object(func);
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ es5id: 15.2.2.1_A2_T3
|
|||
description: The value is an array
|
||||
---*/
|
||||
|
||||
var arr = [1,2,3];
|
||||
var arr = [1, 2, 3];
|
||||
|
||||
var n_obj = new Object(arr);
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ es5id: 15.2.2.1_A2_T5
|
|||
description: The value is a Date object
|
||||
---*/
|
||||
|
||||
var obj = new Date(1978,3);
|
||||
var obj = new Date(1978, 3);
|
||||
|
||||
var n_obj = new Object(obj);
|
||||
|
||||
|
@ -19,6 +19,6 @@ if (n_obj !== obj) {
|
|||
}
|
||||
|
||||
//CHECK#2
|
||||
if ((n_obj.getFullYear() !== 1978)||(n_obj.getMonth() !== 3)) {
|
||||
if ((n_obj.getFullYear() !== 1978) || (n_obj.getMonth() !== 3)) {
|
||||
$ERROR('#2: When the Object constructor is called and if the value is an Object simply value returns.');
|
||||
}
|
||||
|
|
|
@ -21,4 +21,6 @@ if (n_obj() !== 1) {
|
|||
$ERROR('When the Object constructor is called and if the value is an Object simply value returns');
|
||||
}
|
||||
|
||||
function func(){return 1;};
|
||||
function func() {
|
||||
return 1;
|
||||
};
|
||||
|
|
|
@ -14,7 +14,9 @@ if (typeof func !== 'undefined') {
|
|||
$ERROR('#0: function expression can\'t be declarated');
|
||||
}
|
||||
|
||||
var n_obj = new Object(function func(){return 1;});
|
||||
var n_obj = new Object(function func() {
|
||||
return 1;
|
||||
});
|
||||
|
||||
//CHECK#1
|
||||
if (n_obj.constructor !== Function) {
|
||||
|
|
|
@ -12,7 +12,7 @@ description: Argument value is a nonempty string
|
|||
var str = 'Obi-Wan Kenobi';
|
||||
|
||||
//CHECK#1
|
||||
if (typeof str !== 'string') {
|
||||
if (typeof str !== 'string') {
|
||||
$ERROR('#1: "Obi-Wan Kenobi" is NOT a String');
|
||||
}
|
||||
|
||||
|
@ -30,11 +30,11 @@ if (typeof n_obj !== 'object') {
|
|||
}
|
||||
|
||||
//CHECK#4
|
||||
if ( n_obj != str) {
|
||||
if (n_obj != str) {
|
||||
$ERROR('#4: When the Object constructor is called with String argument return ToObject(string)');
|
||||
}
|
||||
|
||||
//CHECK#5
|
||||
if ( n_obj === str) {
|
||||
if (n_obj === str) {
|
||||
$ERROR('#5: When the Object constructor is called with String argument return ToObject(string)');
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ description: Argument value is an empty string
|
|||
var str = '';
|
||||
|
||||
//CHECK#1
|
||||
if (typeof str !== 'string') {
|
||||
if (typeof str !== 'string') {
|
||||
$ERROR('#1: "" is NOT a String');
|
||||
}
|
||||
|
||||
|
@ -29,11 +29,11 @@ if (typeof n_obj !== 'object') {
|
|||
}
|
||||
|
||||
//CHECK#4
|
||||
if ( n_obj != str) {
|
||||
if (n_obj != str) {
|
||||
$ERROR('#4: When the Object constructor is called with String argument return ToObject(string)');
|
||||
}
|
||||
|
||||
//CHECK#5
|
||||
if ( n_obj === str) {
|
||||
if (n_obj === str) {
|
||||
$ERROR('#5: When the Object constructor is called with String argument return ToObject(string)');
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ es5id: 15.2.2.1_A3_T3
|
|||
description: Argument value is sum of empty string and number
|
||||
---*/
|
||||
|
||||
var n_obj = new Object(""+1);
|
||||
var n_obj = new Object("" + 1);
|
||||
|
||||
//CHECK#2
|
||||
if (n_obj.constructor !== String) {
|
||||
|
@ -22,11 +22,11 @@ if (typeof n_obj !== 'object') {
|
|||
}
|
||||
|
||||
//CHECK#4
|
||||
if ( n_obj != "1") {
|
||||
if (n_obj != "1") {
|
||||
$ERROR('#4: When the Object constructor is called with String argument return ToObject(string)');
|
||||
}
|
||||
|
||||
//CHECK#5
|
||||
if ( n_obj === "1") {
|
||||
if (n_obj === "1") {
|
||||
$ERROR('#5: When the Object constructor is called with String argument return ToObject(string)');
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ description: Argument value is "true"
|
|||
var bool = true;
|
||||
|
||||
//CHECK#1
|
||||
if (typeof bool !== 'boolean') {
|
||||
if (typeof bool !== 'boolean') {
|
||||
$ERROR('#1: true is NOT a boolean');
|
||||
}
|
||||
|
||||
|
@ -29,11 +29,11 @@ if (typeof n_obj !== 'object') {
|
|||
}
|
||||
|
||||
//CHECK#4
|
||||
if ( n_obj != bool) {
|
||||
if (n_obj != bool) {
|
||||
$ERROR('#4: When the Object constructor is called with Boolean argument return ToObject(boolean)');
|
||||
}
|
||||
|
||||
//CHECK#5
|
||||
if ( n_obj === bool) {
|
||||
if (n_obj === bool) {
|
||||
$ERROR('#5: When the Object constructor is called with Boolean argument return ToObject(boolean)');
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ description: Argument value is "false"
|
|||
var bool = false;
|
||||
|
||||
//CHECK#1
|
||||
if (typeof bool !== 'boolean') {
|
||||
if (typeof bool !== 'boolean') {
|
||||
$ERROR('#1: false is NOT a boolean');
|
||||
}
|
||||
|
||||
|
@ -29,11 +29,11 @@ if (typeof n_obj !== 'object') {
|
|||
}
|
||||
|
||||
//CHECK#4
|
||||
if ( n_obj != bool) {
|
||||
if (n_obj != bool) {
|
||||
$ERROR('#4: When the Object constructor is called with Boolean argument return ToObject(boolean)');
|
||||
}
|
||||
|
||||
//CHECK#5
|
||||
if ( n_obj === bool) {
|
||||
if (n_obj === bool) {
|
||||
$ERROR('#5: When the Object constructor is called with Boolean argument return ToObject(boolean)');
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ es5id: 15.2.2.1_A4_T3
|
|||
description: Argument value is boolean expression
|
||||
---*/
|
||||
|
||||
var n_obj = new Object((1===1)&&!(false));
|
||||
var n_obj = new Object((1 === 1) && !(false));
|
||||
|
||||
//CHECK#2
|
||||
if (n_obj.constructor !== Boolean) {
|
||||
|
@ -22,11 +22,11 @@ if (typeof n_obj !== 'object') {
|
|||
}
|
||||
|
||||
//CHECK#4
|
||||
if ( n_obj != true) {
|
||||
if (n_obj != true) {
|
||||
$ERROR('#4: When the Object constructor is called with Boolean argument return ToObject(boolean)');
|
||||
}
|
||||
|
||||
//CHECK#5
|
||||
if ( n_obj === true) {
|
||||
if (n_obj === true) {
|
||||
$ERROR('#5: When the Object constructor is called with Boolean argument return ToObject(boolean)');
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ description: Argument value is any number
|
|||
var num = 1.0;
|
||||
|
||||
//CHECK#1
|
||||
if (typeof num !== 'number') {
|
||||
if (typeof num !== 'number') {
|
||||
$ERROR('#1: 1.0 is NOT a number');
|
||||
}
|
||||
|
||||
|
@ -29,11 +29,11 @@ if (typeof n_obj !== 'object') {
|
|||
}
|
||||
|
||||
//CHECK#4
|
||||
if ( n_obj != num) {
|
||||
if (n_obj != num) {
|
||||
$ERROR('#4: When the Object constructor is called with Number argument return ToObject(number)');
|
||||
}
|
||||
|
||||
//CHECK#5
|
||||
if ( n_obj === num) {
|
||||
if (n_obj === num) {
|
||||
$ERROR('#5: When the Object constructor is called with Number argument return ToObject(number)');
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ description: Argument value is NaN
|
|||
var num = NaN;
|
||||
|
||||
//CHECK#1
|
||||
if (typeof num !== 'number') {
|
||||
if (typeof num !== 'number') {
|
||||
$ERROR('#1: NaN is NOT a number');
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ description: Argument value is Infinity
|
|||
var num = Infinity;
|
||||
|
||||
//CHECK#1
|
||||
if (typeof num !== 'number') {
|
||||
if (typeof num !== 'number') {
|
||||
$ERROR('#1: Infinity is NOT a number');
|
||||
}
|
||||
|
||||
|
@ -29,11 +29,11 @@ if (typeof n_obj !== 'object') {
|
|||
}
|
||||
|
||||
//CHECK#4
|
||||
if ( n_obj != num) {
|
||||
if (n_obj != num) {
|
||||
$ERROR('#4: When the Object constructor is called with Number argument return ToObject(number)');
|
||||
}
|
||||
|
||||
//CHECK#5
|
||||
if ( n_obj === num) {
|
||||
if (n_obj === num) {
|
||||
$ERROR('#5: When the Object constructor is called with Number argument return ToObject(number)');
|
||||
}
|
||||
|
|
|
@ -9,7 +9,9 @@ es5id: 15.2.2.1_A5_T4
|
|||
description: Argument value is numeric expression
|
||||
---*/
|
||||
|
||||
var n_obj = new Object( 2*([].length + {q:1}["q"]));
|
||||
var n_obj = new Object(2 * ([].length + {
|
||||
q: 1
|
||||
}["q"]));
|
||||
|
||||
//CHECK#2
|
||||
if (n_obj.constructor !== Number) {
|
||||
|
@ -22,11 +24,11 @@ if (typeof n_obj !== 'object') {
|
|||
}
|
||||
|
||||
//CHECK#4
|
||||
if ( n_obj != 2) {
|
||||
if (n_obj != 2) {
|
||||
$ERROR('#4: When the Object constructor is called with Number argument return ToObject(number)');
|
||||
}
|
||||
|
||||
//CHECK#5
|
||||
if ( n_obj === 2) {
|
||||
if (n_obj === 2) {
|
||||
$ERROR('#5: When the Object constructor is called with Number argument return ToObject(number)');
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ es5id: 15.2.2.1_A6_T1
|
|||
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
|
||||
if (obj.constructor !== Number) {
|
||||
|
@ -22,6 +22,6 @@ if (typeof obj !== "object") {
|
|||
}
|
||||
|
||||
//CHECK#3
|
||||
if ((obj != 1)||(obj === 1)) {
|
||||
if ((obj != 1) || (obj === 1)) {
|
||||
$ERROR('3#: Since Object as a function calling is the same as function calling list of arguments can appears in braces;');
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ es5id: 15.2.2.1_A6_T2
|
|||
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
|
||||
if (obj.constructor !== Object) {
|
||||
|
|
|
@ -9,7 +9,7 @@ es5id: 15.2.2.1_A6_T3
|
|||
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
|
||||
if (obj.constructor !== Number) {
|
||||
|
@ -22,6 +22,6 @@ if (typeof obj !== "object") {
|
|||
}
|
||||
|
||||
//CHECK#3
|
||||
if ((obj != 3)||(obj === 3)) {
|
||||
if ((obj != 3) || (obj === 3)) {
|
||||
$ERROR('3#: Since Object as a function calling is the same as function calling list of arguments can appears in braces;');
|
||||
}
|
||||
|
|
|
@ -7,6 +7,6 @@ es5id: 15.2.3_A1
|
|||
description: Checking existence of the property "prototype"
|
||||
---*/
|
||||
|
||||
if(!Object.hasOwnProperty("prototype")){
|
||||
if (!Object.hasOwnProperty("prototype")) {
|
||||
$ERROR('#1: The Object constructor has the property "prototype"');
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ description: Checking Object.length
|
|||
---*/
|
||||
|
||||
//CHECK#1
|
||||
if(!Object.hasOwnProperty("length")){
|
||||
if (!Object.hasOwnProperty("length")) {
|
||||
$ERROR('#1: The Object constructor has the property "length"');
|
||||
}
|
||||
|
||||
|
|
|
@ -7,10 +7,10 @@ es5id: 15.2_A1
|
|||
description: Checking if Object equals to this.Object
|
||||
---*/
|
||||
|
||||
var obj=Object;
|
||||
var obj = Object;
|
||||
|
||||
var thisobj=this.Object;
|
||||
var thisobj = this.Object;
|
||||
|
||||
if(obj!==thisobj){
|
||||
if (obj !== thisobj) {
|
||||
$ERROR('Object is the property of global');
|
||||
}
|
||||
|
|
|
@ -10,31 +10,31 @@ description: Trying to convert from Boolean to Object
|
|||
---*/
|
||||
|
||||
// CHECK#1
|
||||
if (Object(true).valueOf() !== true){
|
||||
if (Object(true).valueOf() !== true) {
|
||||
$ERROR('#1: Object(true).valueOf() === true. Actual: ' + (Object(true).valueOf()));
|
||||
}
|
||||
|
||||
// CHECK#2
|
||||
if (typeof Object(true) !== "object"){
|
||||
if (typeof Object(true) !== "object") {
|
||||
$ERROR('#2: typeof Object(true) === "object". Actual: ' + (typeof Object(true)));
|
||||
}
|
||||
|
||||
// CHECK#3
|
||||
if (Object(true).constructor.prototype !== Boolean.prototype){
|
||||
if (Object(true).constructor.prototype !== Boolean.prototype) {
|
||||
$ERROR('#3: Object(true).constructor.prototype === Boolean.prototype. Actual: ' + (Object(true).constructor.prototype));
|
||||
}
|
||||
|
||||
// CHECK#4
|
||||
if (Object(false).valueOf() !== false){
|
||||
if (Object(false).valueOf() !== false) {
|
||||
$ERROR('#4: Object(false).valueOf() === false. Actual: ' + (Object(false).valueOf()));
|
||||
}
|
||||
|
||||
// CHECK#5
|
||||
if (typeof Object(false) !== "object"){
|
||||
if (typeof Object(false) !== "object") {
|
||||
$ERROR('#5: typeof Object(false) === "object". Actual: ' + (typeof Object(false)));
|
||||
}
|
||||
|
||||
// CHECK#6
|
||||
if (Object(false).constructor.prototype !== Boolean.prototype){
|
||||
if (Object(false).constructor.prototype !== Boolean.prototype) {
|
||||
$ERROR('#6: Object(false).constructor.prototype === Boolean.prototype. Actual: ' + (Object(false).constructor.prototype));
|
||||
}
|
||||
|
|
|
@ -10,124 +10,124 @@ description: Converting from various numbers to Object
|
|||
---*/
|
||||
|
||||
// CHECK#1
|
||||
if (Object(0).valueOf() !== 0){
|
||||
if (Object(0).valueOf() !== 0) {
|
||||
$ERROR('#1: Object(0).valueOf() === 0. Actual: ' + (Object(0).valueOf()));
|
||||
}
|
||||
|
||||
// CHECK#2
|
||||
if (typeof Object(0) !== "object"){
|
||||
if (typeof Object(0) !== "object") {
|
||||
$ERROR('#2: typeof Object(0) === "object". Actual: ' + (typeof Object(0)));
|
||||
}
|
||||
|
||||
// CHECK#3
|
||||
if (Object(0).constructor.prototype !== Number.prototype){
|
||||
if (Object(0).constructor.prototype !== Number.prototype) {
|
||||
$ERROR('#3: Object(0).constructor.prototype === Number.prototype. Actual: ' + (Object(0).constructor.prototype));
|
||||
}
|
||||
|
||||
// CHECK#4
|
||||
if (Object(-0).valueOf() !== -0){
|
||||
if (Object(-0).valueOf() !== -0) {
|
||||
$ERROR('#4.1: Object(-0).valueOf() === 0. Actual: ' + (Object(-0).valueOf()));
|
||||
} else if (1/Object(-0).valueOf() !== Number.NEGATIVE_INFINITY) {
|
||||
} else if (1 / Object(-0).valueOf() !== Number.NEGATIVE_INFINITY) {
|
||||
$ERROR('#4.2: Object(-0).valueOf() === -0. Actual: +0');
|
||||
}
|
||||
|
||||
// CHECK#5
|
||||
if (typeof Object(-0) !== "object"){
|
||||
if (typeof Object(-0) !== "object") {
|
||||
$ERROR('#5: typeof Object(-0) === "object". Actual: ' + (typeof Object(-0)));
|
||||
}
|
||||
|
||||
// CHECK#6
|
||||
if (Object(-0).constructor.prototype !== Number.prototype){
|
||||
if (Object(-0).constructor.prototype !== Number.prototype) {
|
||||
$ERROR('#6: Object(-0).constructor.prototype === Number.prototype. Actual: ' + (Object(-0).constructor.prototype));
|
||||
}
|
||||
|
||||
// CHECK#7
|
||||
if (Object(1).valueOf() !== 1){
|
||||
if (Object(1).valueOf() !== 1) {
|
||||
$ERROR('#7: Object(1).valueOf() === 1. Actual: ' + (Object(1).valueOf()));
|
||||
}
|
||||
|
||||
// CHECK#8
|
||||
if (typeof Object(1) !== "object"){
|
||||
if (typeof Object(1) !== "object") {
|
||||
$ERROR('#8: typeof Object(1) === "object". Actual: ' + (typeof Object(1)));
|
||||
}
|
||||
|
||||
// CHECK#9
|
||||
if (Object(1).constructor.prototype !== Number.prototype){
|
||||
if (Object(1).constructor.prototype !== Number.prototype) {
|
||||
$ERROR('#9: Object(1).constructor.prototype === Number.prototype. Actual: ' + (Object(1).constructor.prototype));
|
||||
}
|
||||
|
||||
// CHECK#10
|
||||
if (Object(-1).valueOf() !== -1){
|
||||
if (Object(-1).valueOf() !== -1) {
|
||||
$ERROR('#10: Object(-1).valueOf() === -1. Actual: ' + (Object(-1).valueOf()));
|
||||
}
|
||||
|
||||
// CHECK#11
|
||||
if (typeof Object(-1) !== "object"){
|
||||
if (typeof Object(-1) !== "object") {
|
||||
$ERROR('#11: typeof Object(-1) === "object". Actual: ' + (typeof Object(-1)));
|
||||
}
|
||||
|
||||
// CHECK#12
|
||||
if (Object(-1).constructor.prototype !== Number.prototype){
|
||||
if (Object(-1).constructor.prototype !== Number.prototype) {
|
||||
$ERROR('#12: Object(-1).constructor.prototype === Number.prototype. Actual: ' + (Object(-1).constructor.prototype));
|
||||
}
|
||||
|
||||
// CHECK#13
|
||||
if (Object(Number.MIN_VALUE).valueOf() !== Number.MIN_VALUE){
|
||||
if (Object(Number.MIN_VALUE).valueOf() !== Number.MIN_VALUE) {
|
||||
$ERROR('#13: Object(Number.MIN_VALUE).valueOf() === Number.MIN_VALUE. Actual: ' + (Object(Number.MIN_VALUE).valueOf()));
|
||||
}
|
||||
|
||||
// CHECK#14
|
||||
if (typeof Object(Number.MIN_VALUE) !== "object"){
|
||||
if (typeof Object(Number.MIN_VALUE) !== "object") {
|
||||
$ERROR('#14: typeof Object(Number.MIN_VALUE) === "object". Actual: ' + (typeof Object(Number.MIN_VALUE)));
|
||||
}
|
||||
|
||||
// CHECK#15
|
||||
if (Object(Number.MIN_VALUE).constructor.prototype !== Number.prototype){
|
||||
if (Object(Number.MIN_VALUE).constructor.prototype !== Number.prototype) {
|
||||
$ERROR('#15: Object(Number.MIN_VALUE).constructor.prototype === Number.prototype. Actual: ' + (Object(Number.MIN_VALUE).constructor.prototype));
|
||||
}
|
||||
|
||||
// CHECK#16
|
||||
if (Object(Number.MAX_VALUE).valueOf() !== Number.MAX_VALUE){
|
||||
if (Object(Number.MAX_VALUE).valueOf() !== Number.MAX_VALUE) {
|
||||
$ERROR('#16: Object(Number.MAX_VALUE).valueOf() === Number.MAX_VALUE. Actual: ' + (Object(Number.MAX_VALUE).valueOf()));
|
||||
}
|
||||
|
||||
// CHECK#17
|
||||
if (typeof Object(Number.MAX_VALUE) !== "object"){
|
||||
if (typeof Object(Number.MAX_VALUE) !== "object") {
|
||||
$ERROR('#17: typeof Object(Number.MAX_VALUE) === "object". Actual: ' + (typeof Object(Number.MAX_VALUE)));
|
||||
}
|
||||
|
||||
// CHECK#18
|
||||
if (Object(Number.MAX_VALUE).constructor.prototype !== Number.prototype){
|
||||
if (Object(Number.MAX_VALUE).constructor.prototype !== Number.prototype) {
|
||||
$ERROR('#18: Object(Number.MAX_VALUE).constructor.prototype === Number.prototype. Actual: ' + (Object(Number.MAX_VALUE).constructor.prototype));
|
||||
}
|
||||
|
||||
// CHECK#19
|
||||
if (Object(Number.POSITIVE_INFINITY).valueOf() !== Number.POSITIVE_INFINITY){
|
||||
if (Object(Number.POSITIVE_INFINITY).valueOf() !== Number.POSITIVE_INFINITY) {
|
||||
$ERROR('#19: Object(Number.POSITIVE_INFINITY).valueOf() === Number.POSITIVE_INFINITY. Actual: ' + (Object(Number.POSITIVE_INFINITY).valueOf()));
|
||||
}
|
||||
|
||||
// CHECK#20
|
||||
if (typeof Object(Number.POSITIVE_INFINITY) !== "object"){
|
||||
if (typeof Object(Number.POSITIVE_INFINITY) !== "object") {
|
||||
$ERROR('#20: typeof Object(Number.POSITIVE_INFINITY) === "object". Actual: ' + (typeof Object(Number.POSITIVE_INFINITY)));
|
||||
}
|
||||
|
||||
// CHECK#21
|
||||
if (Object(Number.POSITIVE_INFINITY).constructor.prototype !== Number.prototype){
|
||||
if (Object(Number.POSITIVE_INFINITY).constructor.prototype !== Number.prototype) {
|
||||
$ERROR('#21: Object(Number.POSITIVE_INFINITY).constructor.prototype === Number.prototype. Actual: ' + (Object(Number.POSITIVE_INFINITY).constructor.prototype));
|
||||
}
|
||||
|
||||
// CHECK#22
|
||||
if (Object(Number.NEGATIVE_INFINITY).valueOf() !== Number.NEGATIVE_INFINITY){
|
||||
if (Object(Number.NEGATIVE_INFINITY).valueOf() !== Number.NEGATIVE_INFINITY) {
|
||||
$ERROR('#22: Object(Number.NEGATIVE_INFINITY).valueOf() === Number.NEGATIVE_INFINITY. Actual: ' + (Object(Number.NEGATIVE_INFINITY).valueOf()));
|
||||
}
|
||||
|
||||
// CHECK#23
|
||||
if (typeof Object(Number.NEGATIVE_INFINITY) !== "object"){
|
||||
if (typeof Object(Number.NEGATIVE_INFINITY) !== "object") {
|
||||
$ERROR('#23: typeof Object(Number.NEGATIVE_INFINITY) === "object". Actual: ' + (typeof Object(Number.NEGATIVE_INFINITY)));
|
||||
}
|
||||
|
||||
// CHECK#24
|
||||
if (Object(Number.NEGATIVE_INFINITY).constructor.prototype !== Number.prototype){
|
||||
if (Object(Number.NEGATIVE_INFINITY).constructor.prototype !== Number.prototype) {
|
||||
$ERROR('#24: Object(Number.NEGATIVE_INFINITY).constructor.prototype === Number.prototype. Actual: ' + (Object(Number.NEGATIVE_INFINITY).constructor.prototype));
|
||||
}
|
||||
|
||||
|
@ -135,41 +135,41 @@ if (Object(Number.NEGATIVE_INFINITY).constructor.prototype !== Number.prototype)
|
|||
assert.sameValue(Object(NaN).valueOf(), NaN, "Object(NaN).valueOf()");
|
||||
|
||||
// CHECK#26
|
||||
if (typeof Object(Number.NaN) !== "object"){
|
||||
if (typeof Object(Number.NaN) !== "object") {
|
||||
$ERROR('#26: typeof Object(Number.NaN) === "object". Actual: ' + (typeof Object(Number.NaN)));
|
||||
}
|
||||
|
||||
// CHECK#27
|
||||
if (Object(Number.NaN).constructor.prototype !== Number.prototype){
|
||||
if (Object(Number.NaN).constructor.prototype !== Number.prototype) {
|
||||
$ERROR('#27: Object(Number.NaN).constructor.prototype === Number.prototype. Actual: ' + (Object(Number.NaN).constructor.prototype));
|
||||
}
|
||||
|
||||
// CHECK#28
|
||||
if (Object(1.2345).valueOf() !== 1.2345){
|
||||
if (Object(1.2345).valueOf() !== 1.2345) {
|
||||
$ERROR('#28: Object(1.2345).valueOf() === 1.2345. Actual: ' + (Object(1.2345).valueOf()));
|
||||
}
|
||||
|
||||
// CHECK#29
|
||||
if (typeof Object(1.2345) !== "object"){
|
||||
if (typeof Object(1.2345) !== "object") {
|
||||
$ERROR('#29: typeof Object(1.2345) === "object". Actual: ' + (typeof Object(1.2345)));
|
||||
}
|
||||
|
||||
// CHECK#30
|
||||
if (Object(1.2345).constructor.prototype !== Number.prototype){
|
||||
if (Object(1.2345).constructor.prototype !== Number.prototype) {
|
||||
$ERROR('#30: Object(1.2345).constructor.prototype === Number.prototype. Actual: ' + (Object(1.2345).constructor.prototype));
|
||||
}
|
||||
|
||||
// CHECK#31
|
||||
if (Object(-1.2345).valueOf() !== -1.2345){
|
||||
if (Object(-1.2345).valueOf() !== -1.2345) {
|
||||
$ERROR('#31: Object(-1.2345).valueOf() === -1.2345. Actual: ' + (Object(-1.2345).valueOf()));
|
||||
}
|
||||
|
||||
// CHECK#32
|
||||
if (typeof Object(-1.2345) !== "object"){
|
||||
if (typeof Object(-1.2345) !== "object") {
|
||||
$ERROR('#32: typeof Object(-1.2345) === "object". Actual: ' + (typeof Object(-1.2345)));
|
||||
}
|
||||
|
||||
// CHECK#33
|
||||
if (Object(-1.2345).constructor.prototype !== Number.prototype){
|
||||
if (Object(-1.2345).constructor.prototype !== Number.prototype) {
|
||||
$ERROR('#33: Object(-1.2345).constructor.prototype === Number.prototype. Actual: ' + (Object(-1.2345).constructor.prototype));
|
||||
}
|
||||
|
|
|
@ -10,61 +10,61 @@ description: Converting from various strings to Object
|
|||
---*/
|
||||
|
||||
// CHECK#1
|
||||
if (Object("some string").valueOf() !== "some string"){
|
||||
if (Object("some string").valueOf() !== "some string") {
|
||||
$ERROR('#1: Object("some string").valueOf() === "some string". Actual: ' + (Object("some string").valueOf()));
|
||||
}
|
||||
|
||||
// CHECK#2
|
||||
if (typeof Object("some string") !== "object"){
|
||||
if (typeof Object("some string") !== "object") {
|
||||
$ERROR('#2: typeof Object("some string") === "object". Actual: ' + (typeof Object("some string")));
|
||||
}
|
||||
|
||||
// CHECK#3
|
||||
if (Object("some string").constructor.prototype !== String.prototype){
|
||||
if (Object("some string").constructor.prototype !== String.prototype) {
|
||||
$ERROR('#3: Object("some string").constructor.prototype === String.prototype. Actual: ' + (Object("some string").constructor.prototype));
|
||||
}
|
||||
|
||||
// CHECK#4
|
||||
if (Object("").valueOf() !== ""){
|
||||
if (Object("").valueOf() !== "") {
|
||||
$ERROR('#4: Object("").valueOf() === false. Actual: ' + (Object("").valueOf()));
|
||||
}
|
||||
|
||||
// CHECK#5
|
||||
if (typeof Object("") !== "object"){
|
||||
if (typeof Object("") !== "object") {
|
||||
$ERROR('#5: typeof Object("") === "object". Actual: ' + (typeof Object("")));
|
||||
}
|
||||
|
||||
// CHECK#6
|
||||
if (Object("").constructor.prototype !== String.prototype){
|
||||
if (Object("").constructor.prototype !== String.prototype) {
|
||||
$ERROR('#6: Object("").constructor.prototype === String.prototype. Actual: ' + (Object("").constructor.prototype));
|
||||
}
|
||||
|
||||
// CHECK#7
|
||||
if (Object("\r\t\b\n\v\f").valueOf() !== "\r\t\b\n\v\f"){
|
||||
if (Object("\r\t\b\n\v\f").valueOf() !== "\r\t\b\n\v\f") {
|
||||
$ERROR('#7: Object("\\r\\t\\b\\n\\v\\f").valueOf() === false. Actual: ' + (Object("\r\t\b\n\v\f").valueOf()));
|
||||
}
|
||||
|
||||
// CHECK#8
|
||||
if (typeof Object("\r\t\b\n\v\f") !== "object"){
|
||||
if (typeof Object("\r\t\b\n\v\f") !== "object") {
|
||||
$ERROR('#8: typeof Object("\\r\\t\\b\\n\\v\\f") === "object". Actual: ' + (typeof Object("\r\t\b\n\v\f")));
|
||||
}
|
||||
|
||||
// CHECK#9
|
||||
if (Object("\r\t\b\n\v\f").constructor.prototype !== String.prototype){
|
||||
if (Object("\r\t\b\n\v\f").constructor.prototype !== String.prototype) {
|
||||
$ERROR('#9: Object("\\r\\t\\b\\n\\v\\f").constructor.prototype === String.prototype. Actual: ' + (Object("\r\t\b\n\v\f").constructor.prototype));
|
||||
}
|
||||
|
||||
// CHECK#10
|
||||
if (Object(String(10)).valueOf() !== "10"){
|
||||
if (Object(String(10)).valueOf() !== "10") {
|
||||
$ERROR('#10: Object(String(10)).valueOf() === false. Actual: ' + (Object(String(10)).valueOf()));
|
||||
}
|
||||
|
||||
// CHECK#11
|
||||
if (typeof Object(String(10)) !== "object"){
|
||||
if (typeof Object(String(10)) !== "object") {
|
||||
$ERROR('#11: typeof Object(String(10)) === "object". Actual: ' + (typeof Object(String(10))));
|
||||
}
|
||||
|
||||
// CHECK#12
|
||||
if (Object(String(10)).constructor.prototype !== String.prototype){
|
||||
if (Object(String(10)).constructor.prototype !== String.prototype) {
|
||||
$ERROR('#12: Object(String(10)).constructor.prototype === String.prototype. Actual: ' + (Object(String(10)).constructor.prototype));
|
||||
}
|
||||
|
|
|
@ -9,31 +9,33 @@ es5id: 9.9_A6
|
|||
description: Converting from Objects to Object
|
||||
---*/
|
||||
|
||||
function MyObject( val ) {
|
||||
this.value = val;
|
||||
this.valueOf = function (){ return this.value; }
|
||||
function MyObject(val) {
|
||||
this.value = val;
|
||||
this.valueOf = function() {
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
|
||||
var x = new MyObject(1);
|
||||
var y = Object(x);
|
||||
|
||||
// CHECK#1
|
||||
if (y.valueOf() !== x.valueOf()){
|
||||
if (y.valueOf() !== x.valueOf()) {
|
||||
$ERROR('#1: Object(obj).valueOf() === obj.valueOf(). Actual: ' + (Object(obj).valueOf()));
|
||||
}
|
||||
|
||||
// CHECK#2
|
||||
if (typeof y !== typeof x){
|
||||
if (typeof y !== typeof x) {
|
||||
$ERROR('#2: typeof Object(obj) === typeof obj. Actual: ' + (typeof Object(obj)));
|
||||
}
|
||||
|
||||
// CHECK#3
|
||||
if (y.constructor.prototype !== x.constructor.prototype){
|
||||
if (y.constructor.prototype !== x.constructor.prototype) {
|
||||
$ERROR('#3: Object(obj).constructor.prototype === obj.constructor.prototype. Actual: ' + (Object(obj).constructor.prototype));
|
||||
}
|
||||
|
||||
|
||||
// CHECK#4
|
||||
if (y !== x){
|
||||
if (y !== x) {
|
||||
$ERROR('#4: Object(obj) === obj');
|
||||
}
|
||||
|
|
|
@ -7,7 +7,13 @@ description: Object properties are assigned to target in ascending index order,
|
|||
es6id: 19.1.2.1
|
||||
---*/
|
||||
|
||||
var target = {a: 1};
|
||||
var result = Object.assign(target,{a:2},{a:"c"});
|
||||
var target = {
|
||||
a: 1
|
||||
};
|
||||
var result = Object.assign(target, {
|
||||
a: 2
|
||||
}, {
|
||||
a: "c"
|
||||
});
|
||||
|
||||
assert.sameValue(result.a, "c", "The value should be 'c'.");
|
||||
|
|
|
@ -8,9 +8,9 @@ es6id: 19.1.2.1
|
|||
---*/
|
||||
|
||||
var target = 12;
|
||||
var result = Object.assign(target,"aaa","bb2b","1c");
|
||||
var result = Object.assign(target, "aaa", "bb2b", "1c");
|
||||
|
||||
assert.sameValue(Object.keys(result).length, 4 , "The length should be 4 in the final object.");
|
||||
assert.sameValue(Object.keys(result).length, 4, "The length should be 4 in the final object.");
|
||||
assert.sameValue(result[0], "1", "The value should be {\"0\":\"1\"}.");
|
||||
assert.sameValue(result[1], "c", "The value should be {\"1\":\"c\"}.");
|
||||
assert.sameValue(result[2], "2", "The value should be {\"2\":\"2\"}.");
|
||||
|
|
|
@ -7,7 +7,9 @@ esid: sec-object.assign
|
|||
---*/
|
||||
|
||||
//"a" will be an property of the final object and the value should be 1
|
||||
var target = {a:1};
|
||||
var target = {
|
||||
a: 1
|
||||
};
|
||||
/*
|
||||
"1a2c3" have own enumerable properties, so it Should be wrapped to objects;
|
||||
{b:6} is an object,should be assigned to final object.
|
||||
|
@ -15,9 +17,15 @@ undefined and null should be ignored;
|
|||
125 is a number,it cannot has own enumerable properties;
|
||||
{a:"c"},{a:5} will override property a, the value should be 5.
|
||||
*/
|
||||
var result = Object.assign(target,"1a2c3",{a:"c"},undefined,{b:6},null,125,{a:5});
|
||||
var result = Object.assign(target, "1a2c3", {
|
||||
a: "c"
|
||||
}, undefined, {
|
||||
b: 6
|
||||
}, null, 125, {
|
||||
a: 5
|
||||
});
|
||||
|
||||
assert.sameValue(Object.keys(result).length, 7 , "The length should be 7 in the final object.");
|
||||
assert.sameValue(Object.keys(result).length, 7, "The length should be 7 in the final object.");
|
||||
assert.sameValue(result.a, 5, "The value should be {a:5}.");
|
||||
assert.sameValue(result[0], "1", "The value should be {\"0\":\"1\"}.");
|
||||
assert.sameValue(result[1], "a", "The value should be {\"1\":\"a\"}.");
|
||||
|
|
|
@ -7,6 +7,6 @@ esid: sec-object.assign
|
|||
---*/
|
||||
|
||||
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.");
|
||||
|
|
|
@ -9,6 +9,6 @@ features: [Symbol]
|
|||
---*/
|
||||
|
||||
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.");
|
||||
|
|
|
@ -7,7 +7,7 @@ esid: sec-object.assign
|
|||
---*/
|
||||
|
||||
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[1], "2", "The value should be {\"1\":\"2\"}.");
|
||||
|
|
|
@ -7,6 +7,8 @@ description: Test the first argument(target) of Object.Assign(target,...sources)
|
|||
es6id: 19.1.2.1.1
|
||||
---*/
|
||||
|
||||
var result = Object.assign(true,{a:1});
|
||||
var result = Object.assign(true, {
|
||||
a: 1
|
||||
});
|
||||
assert.sameValue(typeof result, "object", "Return value should be an object.");
|
||||
assert.sameValue(result.valueOf(), true, "Return value should be true.");
|
||||
|
|
|
@ -7,4 +7,8 @@ description: Test the first argument(target) of Object.Assign(target,...sources)
|
|||
es6id: 19.1.2.1.1
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function(){Object.assign(null, {a:1});});
|
||||
assert.throws(TypeError, function() {
|
||||
Object.assign(null, {
|
||||
a: 1
|
||||
});
|
||||
});
|
||||
|
|
|
@ -7,6 +7,8 @@ description: Test the first argument(target) of Object.Assign(target,...sources)
|
|||
es6id: 19.1.2.1.1
|
||||
---*/
|
||||
|
||||
var result = Object.assign(1,{a:1});
|
||||
var result = Object.assign(1, {
|
||||
a: 1
|
||||
});
|
||||
assert.sameValue(typeof result, "object", "Return value should be an object.");
|
||||
assert.sameValue(result.valueOf(), 1, "Return value should be 1.");
|
||||
|
|
|
@ -7,8 +7,12 @@ description: Test the first argument(target) of Object.Assign(target,...sources)
|
|||
es6id: 19.1.2.1.1
|
||||
---*/
|
||||
|
||||
var target = {foo: 1};
|
||||
var result = Object.assign(target,{a:2});
|
||||
var target = {
|
||||
foo: 1
|
||||
};
|
||||
var result = Object.assign(target, {
|
||||
a: 2
|
||||
});
|
||||
|
||||
assert.sameValue(result.foo, 1, "The value should be {foo: 1}.");
|
||||
assert.sameValue(result.a, 2, "The value should be {a: 2}.");
|
||||
|
|
|
@ -7,6 +7,8 @@ description: Test the first argument(target) of Object.Assign(target,...sources)
|
|||
es6id: 19.1.2.1.1
|
||||
---*/
|
||||
|
||||
var result = Object.assign("test",{a:1});
|
||||
var result = Object.assign("test", {
|
||||
a: 1
|
||||
});
|
||||
assert.sameValue(typeof result, "object", "Return value should be an object.");
|
||||
assert.sameValue(result.valueOf(), "test", "Return value should be 'test'.");
|
||||
|
|
|
@ -9,7 +9,9 @@ features: [Symbol]
|
|||
---*/
|
||||
|
||||
var target = Symbol('foo');
|
||||
var result = Object.assign(target,{a:1});
|
||||
var result = Object.assign(target, {
|
||||
a: 1
|
||||
});
|
||||
|
||||
assert.sameValue(typeof result, "object", "Return value should be a symbol object.");
|
||||
assert.sameValue(result.toString(), "Symbol(foo)", "Return value should be 'Symbol(foo)'.");
|
||||
|
|
|
@ -7,4 +7,8 @@ description: Test the first argument(target) of Object.Assign(target,...sources)
|
|||
es6id: 19.1.2.1.1
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function(){Object.assign(undefined, {a:1});});
|
||||
assert.throws(TypeError, function() {
|
||||
Object.assign(undefined, {
|
||||
a: 1
|
||||
});
|
||||
});
|
||||
|
|
|
@ -28,4 +28,3 @@ assert.sameValue(
|
|||
verifyNotEnumerable(Object.assign, 'name');
|
||||
verifyNotWritable(Object.assign, 'name');
|
||||
verifyConfigurable(Object.assign, 'name');
|
||||
|
||||
|
|
|
@ -13,7 +13,9 @@ info: |
|
|||
features: [Proxy]
|
||||
---*/
|
||||
|
||||
var source = new Proxy({ attr: null }, {
|
||||
var source = new Proxy({
|
||||
attr: null
|
||||
}, {
|
||||
getOwnPropertyDescriptor: function() {
|
||||
throw new Test262Error();
|
||||
}
|
||||
|
|
|
@ -21,5 +21,7 @@ Object.defineProperty(target, 'attr', {
|
|||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Object.assign(target, { attr: 1 });
|
||||
Object.assign(target, {
|
||||
attr: 1
|
||||
});
|
||||
});
|
||||
|
|
|
@ -23,5 +23,7 @@ Object.defineProperty(target, 'attr', {
|
|||
});
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
Object.assign(target, { attr: 1 });
|
||||
Object.assign(target, {
|
||||
attr: 1
|
||||
});
|
||||
});
|
||||
|
|
|
@ -8,5 +8,5 @@ description: Object.create throws TypeError if 'O' is undefined
|
|||
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Object.create(undefined);
|
||||
Object.create(undefined);
|
||||
});
|
||||
|
|
|
@ -6,4 +6,4 @@ es5id: 15.2.3.5-1-2
|
|||
description: Object.create TypeError is not thrown if 'O' is null
|
||||
---*/
|
||||
|
||||
Object.create(null);
|
||||
Object.create(null);
|
||||
|
|
|
@ -8,5 +8,5 @@ description: Object.create throws TypeError if 'O' is a boolean primitive
|
|||
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Object.create(true);
|
||||
Object.create(true);
|
||||
});
|
||||
|
|
|
@ -8,5 +8,5 @@ description: Object.create throws TypeError if 'O' is a number primitive
|
|||
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Object.create(2);
|
||||
Object.create(2);
|
||||
});
|
||||
|
|
|
@ -8,5 +8,5 @@ description: Object.create throws TypeError if type of first param is not Object
|
|||
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Object.create(0);
|
||||
Object.create(0);
|
||||
});
|
||||
|
|
|
@ -9,9 +9,9 @@ es5id: 15.2.3.5-2-1
|
|||
description: Object.create creates new Object
|
||||
---*/
|
||||
|
||||
function base() {}
|
||||
var b = new base();
|
||||
var prop = new Object();
|
||||
var d = Object.create(b);
|
||||
function base() {}
|
||||
var b = new base();
|
||||
var prop = new Object();
|
||||
var d = Object.create(b);
|
||||
|
||||
assert.sameValue(typeof d, 'object', 'typeof d');
|
||||
|
|
|
@ -6,6 +6,6 @@ es5id: 15.2.3.5-2-2
|
|||
description: Object.create - returned object is an instance of Object
|
||||
---*/
|
||||
|
||||
var newObj = Object.create({});
|
||||
var newObj = Object.create({});
|
||||
|
||||
assert(newObj instanceof Object, 'newObj instanceof Object !== true');
|
||||
|
|
|
@ -9,9 +9,9 @@ es5id: 15.2.3.5-3-1
|
|||
description: Object.create sets the prototype of the passed-in object
|
||||
---*/
|
||||
|
||||
function base() {}
|
||||
var b = new base();
|
||||
var d = Object.create(b);
|
||||
function base() {}
|
||||
var b = new base();
|
||||
var d = Object.create(b);
|
||||
|
||||
assert.sameValue(Object.getPrototypeOf(d), b, 'Object.getPrototypeOf(d)');
|
||||
assert.sameValue(b.isPrototypeOf(d), true, 'b.isPrototypeOf(d)');
|
||||
|
|
|
@ -11,11 +11,19 @@ description: >
|
|||
new properties
|
||||
---*/
|
||||
|
||||
function base() {}
|
||||
var b = new base();
|
||||
var prop = new Object();
|
||||
var d = Object.create(b,{ "x": {value: true,writable: false},
|
||||
"y": {value: "str",writable: false} });
|
||||
function base() {}
|
||||
var b = new base();
|
||||
var prop = new Object();
|
||||
var d = Object.create(b, {
|
||||
"x": {
|
||||
value: true,
|
||||
writable: false
|
||||
},
|
||||
"y": {
|
||||
value: "str",
|
||||
writable: false
|
||||
}
|
||||
});
|
||||
|
||||
assert.sameValue(Object.getPrototypeOf(d), b, 'Object.getPrototypeOf(d)');
|
||||
assert.sameValue(b.isPrototypeOf(d), true, 'b.isPrototypeOf(d)');
|
||||
|
|
|
@ -8,17 +8,17 @@ description: >
|
|||
step 2)
|
||||
---*/
|
||||
|
||||
var result = false;
|
||||
Object.defineProperty(Math, "prop", {
|
||||
get: function () {
|
||||
result = (this === Math);
|
||||
return {};
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
var result = false;
|
||||
Object.defineProperty(Math, "prop", {
|
||||
get: function() {
|
||||
result = (this === Math);
|
||||
return {};
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
var newObj = Object.create({}, Math);
|
||||
var newObj = Object.create({}, Math);
|
||||
|
||||
assert(result, 'result !== true');
|
||||
assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true');
|
||||
|
|
|
@ -10,9 +10,9 @@ includes: [propertyHelper.js]
|
|||
---*/
|
||||
|
||||
var newObj = Object.create({}, {
|
||||
prop: {
|
||||
value: "ownDataProperty"
|
||||
}
|
||||
prop: {
|
||||
value: "ownDataProperty"
|
||||
}
|
||||
});
|
||||
|
||||
assert(newObj.hasOwnProperty("prop"), "expected newObj to have 'prop'");
|
||||
|
|
|
@ -10,9 +10,9 @@ includes: [propertyHelper.js]
|
|||
---*/
|
||||
|
||||
var newObj = Object.create({}, {
|
||||
prop: {
|
||||
configurable: false
|
||||
}
|
||||
prop: {
|
||||
configurable: false
|
||||
}
|
||||
});
|
||||
|
||||
assert(newObj.hasOwnProperty("prop"));
|
||||
|
|
|
@ -8,21 +8,21 @@ description: >
|
|||
'Properties' is an inherited data property (8.10.5 step 4.a)
|
||||
---*/
|
||||
|
||||
var proto = {
|
||||
configurable: true
|
||||
};
|
||||
var proto = {
|
||||
configurable: true
|
||||
};
|
||||
|
||||
var ConstructFun = function () { };
|
||||
ConstructFun.prototype = proto;
|
||||
var descObj = new ConstructFun();
|
||||
var ConstructFun = function() {};
|
||||
ConstructFun.prototype = proto;
|
||||
var descObj = new ConstructFun();
|
||||
|
||||
var newObj = Object.create({}, {
|
||||
prop: descObj
|
||||
});
|
||||
var newObj = Object.create({}, {
|
||||
prop: descObj
|
||||
});
|
||||
|
||||
var result1 = newObj.hasOwnProperty("prop");
|
||||
delete newObj.prop;
|
||||
var result2 = newObj.hasOwnProperty("prop");
|
||||
var result1 = newObj.hasOwnProperty("prop");
|
||||
delete newObj.prop;
|
||||
var result2 = newObj.hasOwnProperty("prop");
|
||||
|
||||
assert.sameValue(result1, true, 'result1');
|
||||
assert.sameValue(result2, false, 'result2');
|
||||
|
|
|
@ -11,21 +11,20 @@ includes: [propertyHelper.js]
|
|||
---*/
|
||||
|
||||
var proto = {
|
||||
configurable: true
|
||||
configurable: true
|
||||
};
|
||||
|
||||
var ConstructFun = function () { };
|
||||
var ConstructFun = function() {};
|
||||
ConstructFun.prototype = proto;
|
||||
var descObj = new ConstructFun();
|
||||
|
||||
Object.defineProperty(descObj, "configurable", {
|
||||
value: false
|
||||
value: false
|
||||
});
|
||||
|
||||
var newObj = Object.create({}, {
|
||||
prop: descObj
|
||||
prop: descObj
|
||||
});
|
||||
|
||||
assert(newObj.hasOwnProperty("prop"));
|
||||
verifyNotConfigurable(newObj, "prop");
|
||||
|
||||
|
|
|
@ -12,21 +12,21 @@ includes: [propertyHelper.js]
|
|||
|
||||
var proto = {};
|
||||
Object.defineProperty(proto, "configurable", {
|
||||
get: function () {
|
||||
return true;
|
||||
}
|
||||
get: function() {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
var ConstructFun = function () { };
|
||||
var ConstructFun = function() {};
|
||||
ConstructFun.prototype = proto;
|
||||
var descObj = new ConstructFun();
|
||||
|
||||
Object.defineProperty(descObj, "configurable", {
|
||||
value: false
|
||||
value: false
|
||||
});
|
||||
|
||||
var newObj = Object.create({}, {
|
||||
prop: descObj
|
||||
prop: descObj
|
||||
});
|
||||
|
||||
assert(newObj.hasOwnProperty("prop"));
|
||||
|
|
|
@ -8,19 +8,19 @@ description: >
|
|||
'Properties' is own accessor property (8.10.5 step 4.a)
|
||||
---*/
|
||||
|
||||
var descObj = {};
|
||||
Object.defineProperty(descObj, "configurable", {
|
||||
get: function () {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
var descObj = {};
|
||||
Object.defineProperty(descObj, "configurable", {
|
||||
get: function() {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
var newObj = Object.create({}, {
|
||||
prop: descObj
|
||||
});
|
||||
var result1 = newObj.hasOwnProperty("prop");
|
||||
delete newObj.prop;
|
||||
var result2 = newObj.hasOwnProperty("prop");
|
||||
var newObj = Object.create({}, {
|
||||
prop: descObj
|
||||
});
|
||||
var result1 = newObj.hasOwnProperty("prop");
|
||||
delete newObj.prop;
|
||||
var result2 = newObj.hasOwnProperty("prop");
|
||||
|
||||
assert.sameValue(result1, true, 'result1');
|
||||
assert.sameValue(result2, false, 'result2');
|
||||
|
|
|
@ -8,24 +8,24 @@ description: >
|
|||
'Properties' is an inherited accessor property (8.10.5 step 4.a)
|
||||
---*/
|
||||
|
||||
var proto = {};
|
||||
var proto = {};
|
||||
|
||||
Object.defineProperty(proto, "configurable", {
|
||||
get: function () {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(proto, "configurable", {
|
||||
get: function() {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
var ConstructFun = function () { };
|
||||
ConstructFun.prototype = proto;
|
||||
var descObj = new ConstructFun();
|
||||
var ConstructFun = function() {};
|
||||
ConstructFun.prototype = proto;
|
||||
var descObj = new ConstructFun();
|
||||
|
||||
var newObj = Object.create({}, {
|
||||
prop: descObj
|
||||
});
|
||||
var result1 = newObj.hasOwnProperty("prop");
|
||||
delete newObj.prop;
|
||||
var result2 = newObj.hasOwnProperty("prop");
|
||||
var newObj = Object.create({}, {
|
||||
prop: descObj
|
||||
});
|
||||
var result1 = newObj.hasOwnProperty("prop");
|
||||
delete newObj.prop;
|
||||
var result2 = newObj.hasOwnProperty("prop");
|
||||
|
||||
assert.sameValue(result1, true, 'result1');
|
||||
assert.sameValue(result2, false, 'result2');
|
||||
|
|
|
@ -11,23 +11,22 @@ includes: [propertyHelper.js]
|
|||
---*/
|
||||
|
||||
var proto = {
|
||||
configurable: true
|
||||
configurable: true
|
||||
};
|
||||
|
||||
var ConstructFun = function () { };
|
||||
var ConstructFun = function() {};
|
||||
ConstructFun.prototype = proto;
|
||||
var descObj = new ConstructFun();
|
||||
|
||||
Object.defineProperty(descObj, "configurable", {
|
||||
get: function () {
|
||||
return false;
|
||||
}
|
||||
get: function() {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
var newObj = Object.create({}, {
|
||||
prop: descObj
|
||||
prop: descObj
|
||||
});
|
||||
|
||||
assert(newObj.hasOwnProperty("prop"));
|
||||
verifyNotConfigurable(newObj, "prop");
|
||||
|
||||
|
|
|
@ -12,23 +12,23 @@ includes: [propertyHelper.js]
|
|||
|
||||
var proto = {};
|
||||
Object.defineProperty(proto, "configurable", {
|
||||
get: function () {
|
||||
return true;
|
||||
}
|
||||
get: function() {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
var ConstructFun = function () { };
|
||||
var ConstructFun = function() {};
|
||||
ConstructFun.prototype = proto;
|
||||
var descObj = new ConstructFun();
|
||||
|
||||
Object.defineProperty(descObj, "configurable", {
|
||||
get: function () {
|
||||
return false;
|
||||
}
|
||||
get: function() {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
var newObj = Object.create({}, {
|
||||
prop: descObj
|
||||
prop: descObj
|
||||
});
|
||||
|
||||
assert(newObj.hasOwnProperty("prop"));
|
||||
|
|
|
@ -12,11 +12,11 @@ includes: [propertyHelper.js]
|
|||
|
||||
var descObj = {};
|
||||
Object.defineProperty(descObj, "configurable", {
|
||||
set: function () { }
|
||||
set: function() {}
|
||||
});
|
||||
|
||||
var newObj = Object.create({}, {
|
||||
prop: descObj
|
||||
prop: descObj
|
||||
});
|
||||
|
||||
assert(newObj.hasOwnProperty("prop"));
|
||||
|
|
|
@ -8,17 +8,17 @@ description: >
|
|||
step 2)
|
||||
---*/
|
||||
|
||||
var props = new Date();
|
||||
var result = false;
|
||||
var props = new Date();
|
||||
var result = false;
|
||||
|
||||
Object.defineProperty(props, "prop", {
|
||||
get: function () {
|
||||
result = this instanceof Date;
|
||||
return {};
|
||||
},
|
||||
enumerable: true
|
||||
});
|
||||
var newObj = Object.create({}, props);
|
||||
Object.defineProperty(props, "prop", {
|
||||
get: function() {
|
||||
result = this instanceof Date;
|
||||
return {};
|
||||
},
|
||||
enumerable: true
|
||||
});
|
||||
var newObj = Object.create({}, props);
|
||||
|
||||
assert(result, 'result !== true');
|
||||
assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true');
|
||||
|
|
|
@ -12,21 +12,21 @@ includes: [propertyHelper.js]
|
|||
|
||||
var proto = {};
|
||||
Object.defineProperty(proto, "configurable", {
|
||||
get: function () {
|
||||
return true;
|
||||
}
|
||||
get: function() {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
var ConstructFun = function () { };
|
||||
var ConstructFun = function() {};
|
||||
ConstructFun.prototype = proto;
|
||||
var descObj = new ConstructFun();
|
||||
|
||||
Object.defineProperty(descObj, "configurable", {
|
||||
set: function () { }
|
||||
set: function() {}
|
||||
});
|
||||
|
||||
var newObj = Object.create({}, {
|
||||
prop: descObj
|
||||
prop: descObj
|
||||
});
|
||||
|
||||
assert(newObj.hasOwnProperty("prop"));
|
||||
|
|
|
@ -13,15 +13,15 @@ includes: [propertyHelper.js]
|
|||
var proto = {};
|
||||
|
||||
Object.defineProperty(proto, "configurable", {
|
||||
set: function () { }
|
||||
set: function() {}
|
||||
});
|
||||
|
||||
var ConstructFun = function () { };
|
||||
var ConstructFun = function() {};
|
||||
ConstructFun.prototype = proto;
|
||||
var descObj = new ConstructFun();
|
||||
|
||||
var newObj = Object.create({}, {
|
||||
prop: descObj
|
||||
prop: descObj
|
||||
});
|
||||
|
||||
assert(newObj.hasOwnProperty("prop"));
|
||||
|
|
|
@ -9,17 +9,17 @@ description: >
|
|||
'configurable' property (8.10.5 step 4.a)
|
||||
---*/
|
||||
|
||||
var descObj = function () { };
|
||||
var descObj = function() {};
|
||||
|
||||
descObj.configurable = true;
|
||||
descObj.configurable = true;
|
||||
|
||||
var newObj = Object.create({}, {
|
||||
prop: descObj
|
||||
});
|
||||
var newObj = Object.create({}, {
|
||||
prop: descObj
|
||||
});
|
||||
|
||||
var result1 = newObj.hasOwnProperty("prop");
|
||||
delete newObj.prop;
|
||||
var result2 = newObj.hasOwnProperty("prop");
|
||||
var result1 = newObj.hasOwnProperty("prop");
|
||||
delete newObj.prop;
|
||||
var result2 = newObj.hasOwnProperty("prop");
|
||||
|
||||
assert.sameValue(result1, true, 'result1');
|
||||
assert.sameValue(result2, false, 'result2');
|
||||
|
|
|
@ -9,17 +9,17 @@ description: >
|
|||
property (8.10.5 step 4.a)
|
||||
---*/
|
||||
|
||||
var descObj = [];
|
||||
var descObj = [];
|
||||
|
||||
descObj.configurable = true;
|
||||
descObj.configurable = true;
|
||||
|
||||
var newObj = Object.create({}, {
|
||||
prop: descObj
|
||||
});
|
||||
var newObj = Object.create({}, {
|
||||
prop: descObj
|
||||
});
|
||||
|
||||
var result1 = newObj.hasOwnProperty("prop");
|
||||
delete newObj.prop;
|
||||
var result2 = newObj.hasOwnProperty("prop");
|
||||
var result1 = newObj.hasOwnProperty("prop");
|
||||
delete newObj.prop;
|
||||
var result2 = newObj.hasOwnProperty("prop");
|
||||
|
||||
assert.sameValue(result1, true, 'result1');
|
||||
assert.sameValue(result2, false, 'result2');
|
||||
|
|
|
@ -9,16 +9,16 @@ description: >
|
|||
property (8.10.5 step 4.a)
|
||||
---*/
|
||||
|
||||
var descObj = new String();
|
||||
var descObj = new String();
|
||||
|
||||
descObj.configurable = true;
|
||||
descObj.configurable = true;
|
||||
|
||||
var newObj = Object.create({}, {
|
||||
prop: descObj
|
||||
});
|
||||
var result1 = newObj.hasOwnProperty("prop");
|
||||
delete newObj.prop;
|
||||
var result2 = newObj.hasOwnProperty("prop");
|
||||
var newObj = Object.create({}, {
|
||||
prop: descObj
|
||||
});
|
||||
var result1 = newObj.hasOwnProperty("prop");
|
||||
delete newObj.prop;
|
||||
var result2 = newObj.hasOwnProperty("prop");
|
||||
|
||||
assert.sameValue(result1, true, 'result1');
|
||||
assert.sameValue(result2, false, 'result2');
|
||||
|
|
|
@ -9,17 +9,17 @@ description: >
|
|||
property (8.10.5 step 4.a)
|
||||
---*/
|
||||
|
||||
var descObj = new Boolean(false);
|
||||
var descObj = new Boolean(false);
|
||||
|
||||
descObj.configurable = true;
|
||||
descObj.configurable = true;
|
||||
|
||||
var newObj = Object.create({}, {
|
||||
prop: descObj
|
||||
});
|
||||
var newObj = Object.create({}, {
|
||||
prop: descObj
|
||||
});
|
||||
|
||||
var result1 = newObj.hasOwnProperty("prop");
|
||||
delete newObj.prop;
|
||||
var result2 = newObj.hasOwnProperty("prop");
|
||||
var result1 = newObj.hasOwnProperty("prop");
|
||||
delete newObj.prop;
|
||||
var result2 = newObj.hasOwnProperty("prop");
|
||||
|
||||
assert.sameValue(result1, true, 'result1');
|
||||
assert.sameValue(result2, false, 'result2');
|
||||
|
|
|
@ -9,17 +9,17 @@ description: >
|
|||
property (8.10.5 step 4.a)
|
||||
---*/
|
||||
|
||||
var descObj = new Number(-9);
|
||||
var descObj = new Number(-9);
|
||||
|
||||
descObj.configurable = true;
|
||||
descObj.configurable = true;
|
||||
|
||||
var newObj = Object.create({}, {
|
||||
prop: descObj
|
||||
});
|
||||
var newObj = Object.create({}, {
|
||||
prop: descObj
|
||||
});
|
||||
|
||||
var result1 = newObj.hasOwnProperty("prop");
|
||||
delete newObj.prop;
|
||||
var result2 = newObj.hasOwnProperty("prop");
|
||||
var result1 = newObj.hasOwnProperty("prop");
|
||||
delete newObj.prop;
|
||||
var result2 = newObj.hasOwnProperty("prop");
|
||||
|
||||
assert.sameValue(result1, true, 'result1');
|
||||
assert.sameValue(result2, false, 'result2');
|
||||
|
|
|
@ -9,15 +9,15 @@ description: >
|
|||
property (8.10.5 step 4.a)
|
||||
---*/
|
||||
|
||||
Math.configurable = true;
|
||||
Math.configurable = true;
|
||||
|
||||
var newObj = Object.create({}, {
|
||||
prop: Math
|
||||
});
|
||||
var newObj = Object.create({}, {
|
||||
prop: Math
|
||||
});
|
||||
|
||||
var result1 = newObj.hasOwnProperty("prop");
|
||||
delete newObj.prop;
|
||||
var result2 = newObj.hasOwnProperty("prop");
|
||||
var result1 = newObj.hasOwnProperty("prop");
|
||||
delete newObj.prop;
|
||||
var result2 = newObj.hasOwnProperty("prop");
|
||||
|
||||
assert.sameValue(result1, true, 'result1');
|
||||
assert.sameValue(result2, false, 'result2');
|
||||
|
|
|
@ -9,17 +9,17 @@ description: >
|
|||
(8.10.5 step 4.a)
|
||||
---*/
|
||||
|
||||
var descObj = new Date();
|
||||
var descObj = new Date();
|
||||
|
||||
descObj.configurable = true;
|
||||
descObj.configurable = true;
|
||||
|
||||
var newObj = Object.create({}, {
|
||||
prop: descObj
|
||||
});
|
||||
var newObj = Object.create({}, {
|
||||
prop: descObj
|
||||
});
|
||||
|
||||
var result1 = newObj.hasOwnProperty("prop");
|
||||
delete newObj.prop;
|
||||
var result2 = newObj.hasOwnProperty("prop");
|
||||
var result1 = newObj.hasOwnProperty("prop");
|
||||
delete newObj.prop;
|
||||
var result2 = newObj.hasOwnProperty("prop");
|
||||
|
||||
assert.sameValue(result1, true, 'result1');
|
||||
assert.sameValue(result2, false, 'result2');
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue