|
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 |
|
7 /** |
|
8 File Name: 15.2.1.2.js |
|
9 ECMA Section: 15.2.1.2 The Object Constructor Called as a Function: |
|
10 Object(value) |
|
11 Description: When Object is called as a function rather than as a |
|
12 constructor, the following steps are taken: |
|
13 |
|
14 1. If value is null or undefined, create and return a |
|
15 new object with no proerties other than internal |
|
16 properties exactly as if the object constructor |
|
17 had been called on that same value (15.2.2.1). |
|
18 2. Return ToObject (value), whose rules are: |
|
19 |
|
20 undefined generate a runtime error |
|
21 null generate a runtime error |
|
22 boolean create a new Boolean object whose default |
|
23 value is the value of the boolean. |
|
24 number Create a new Number object whose default |
|
25 value is the value of the number. |
|
26 string Create a new String object whose default |
|
27 value is the value of the string. |
|
28 object Return the input argument (no conversion). |
|
29 |
|
30 Author: christine@netscape.com |
|
31 Date: 17 july 1997 |
|
32 */ |
|
33 |
|
34 var SECTION = "15.2.1.2"; |
|
35 var VERSION = "ECMA_1"; |
|
36 startTest(); |
|
37 var TITLE = "Object()"; |
|
38 |
|
39 writeHeaderToLog( SECTION + " "+ TITLE); |
|
40 |
|
41 var MYOB = Object(); |
|
42 |
|
43 new TestCase( SECTION, "var MYOB = Object(); MYOB.valueOf()", MYOB, MYOB.valueOf() ); |
|
44 new TestCase( SECTION, "typeof Object()", "object", typeof (Object(null)) ); |
|
45 new TestCase( SECTION, "var MYOB = Object(); MYOB.toString()", "[object Object]", eval("var MYOB = Object(); MYOB.toString()") ); |
|
46 |
|
47 test(); |