|
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.4.1.3.js |
|
9 ECMA Section: 15.4.1.3 Array() |
|
10 |
|
11 Description: When Array is called as a function rather than as a |
|
12 constructor, it creates and initializes a new array |
|
13 object. Thus, the function call Array(...) is |
|
14 equivalent to the object creationi new Array(...) with |
|
15 the same arguments. |
|
16 |
|
17 An array is created and returned as if by the |
|
18 expression new Array(len). |
|
19 |
|
20 Author: christine@netscape.com |
|
21 Date: 7 october 1997 |
|
22 */ |
|
23 var SECTION = "15.4.1.3"; |
|
24 var VERSION = "ECMA_1"; |
|
25 startTest(); |
|
26 var TITLE = "Array Constructor Called as a Function: Array()"; |
|
27 |
|
28 writeHeaderToLog( SECTION + " "+ TITLE); |
|
29 |
|
30 new TestCase( SECTION, |
|
31 "typeof Array()", |
|
32 "object", |
|
33 typeof Array() ); |
|
34 |
|
35 new TestCase( SECTION, |
|
36 "MYARR = new Array();MYARR.getClass = Object.prototype.toString;MYARR.getClass()", |
|
37 "[object Array]", |
|
38 eval("MYARR = Array();MYARR.getClass = Object.prototype.toString;MYARR.getClass()") ); |
|
39 |
|
40 new TestCase( SECTION, |
|
41 "(Array()).length", |
|
42 0, |
|
43 (Array()).length ); |
|
44 |
|
45 new TestCase( SECTION, |
|
46 "Array().toString()", |
|
47 "", |
|
48 Array().toString() ); |
|
49 |
|
50 test(); |