Debian Codegraph @

rhino/testsrc/tests/ecma/ObjectObjects/15.2.1.2.js

raw symbols SCIP
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 gTestfile = '15.2.1.2.js';
7
8 /**
9 File Name: 15.2.1.2.js
10 ECMA Section: 15.2.1.2 The Object Constructor Called as a Function:
11 Object(value)
12 Description: When Object is called as a function rather than as a
13 constructor, the following steps are taken:
14
15 1. If value is null or undefined, create and return a
16 new object with no proerties other than internal
17 properties exactly as if the object constructor
18 had been called on that same value (15.2.2.1).
19 2. Return ToObject (value), whose rules are:
20
21 undefined generate a runtime error
22 null generate a runtime error
23 boolean create a new Boolean object whose default
24 value is the value of the boolean.
25 number Create a new Number object whose default
26 value is the value of the number.
27 string Create a new String object whose default
28 value is the value of the string.
29 object Return the input argument (no conversion).
30
31 Author: [email protected]
32 Date: 17 july 1997
33 */
34
35 var SECTION = "15.2.1.2";
36 var VERSION = "ECMA_1";
37 startTest();
38 var TITLE = "Object()";
39
40 writeHeaderToLog( SECTION + " "+ TITLE);
41
42 var MYOB = Object();
43
44 new TestCase( SECTION, "var MYOB = Object(); MYOB.valueOf()", MYOB, MYOB.valueOf() );
45 new TestCase( SECTION, "typeof Object()", "object", typeof (Object(null)) );
46 new TestCase( SECTION, "var MYOB = Object(); MYOB.toString()", "[object Object]", eval("var MYOB = Object(); MYOB.toString()") );
47
48 test();