S15.2.2.1_A1_T2.js (1504B)
1 // Copyright 2009 the Sputnik authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 info: | 6 When the Object constructor is called with no arguments the following steps are taken: 7 (The argument value was not supplied or its type was Null or Undefined.) 8 i) Create a new native ECMAScript object. 9 ii) The [[Prototype]] property of the newly constructed object is set to the Object prototype object. 10 iii) The [[Class]] property of the newly constructed object is set to "Object". 11 iv) The newly constructed object has no [[Value]] property. 12 v) Return the newly created native object 13 es5id: 15.2.2.1_A1_T2 14 description: Creating new Object(void 0) and checking its properties 15 ---*/ 16 17 //var foo = void 0; 18 var obj = new Object(void 0); 19 20 assert.notSameValue(obj, undefined, 'The value of obj is expected to not equal ``undefined``'); 21 assert.sameValue(obj.constructor, Object, 'The value of obj.constructor is expected to equal the value of Object'); 22 23 assert( 24 !!Object.prototype.isPrototypeOf(obj), 25 'The value of !!Object.prototype.isPrototypeOf(obj) is expected to be true' 26 ); 27 28 var to_string_result = '[object ' + 'Object' + ']'; 29 assert.sameValue(obj.toString(), to_string_result, 'obj.toString() returns to_string_result'); 30 31 assert.sameValue( 32 obj.valueOf().toString(), 33 to_string_result.toString(), 34 'obj.valueOf().toString() must return the same value returned by to_string_result.toString()' 35 ); 36 37 reportCompare(0, 0);