Debian Codegraph @

js/src/tests/test262/built-ins/Object/S15.2.2.1_A1_T3.js

raw
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_T3
14 description: Creating new Object(null) and checking its properties
15 ---*/
16
17 var obj = new Object(null);
18
19 assert.notSameValue(obj, undefined, 'The value of obj is expected to not equal ``undefined``');
20 assert.sameValue(obj.constructor, Object, 'The value of obj.constructor is expected to equal the value of Object');
21
22 assert(
23 !!Object.prototype.isPrototypeOf(obj),
24 'The value of !!Object.prototype.isPrototypeOf(obj) is expected to be true'
25 );
26
27 var to_string_result = '[object ' + 'Object' + ']';
28 assert.sameValue(obj.toString(), to_string_result, 'obj.toString() returns to_string_result');
29
30 assert.sameValue(
31 obj.valueOf().toString(),
32 to_string_result.toString(),
33 'obj.valueOf().toString() must return the same value returned by to_string_result.toString()'
34 );
35
36 reportCompare(0, 0);