1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
\r
2 /* ***** BEGIN LICENSE BLOCK *****
\r
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
\r
5 * The contents of this file are subject to the Mozilla Public License Version
\r
6 * 1.1 (the "License"); you may not use this file except in compliance with
\r
7 * the License. You may obtain a copy of the License at
\r
8 * http://www.mozilla.org/MPL/
\r
10 * Software distributed under the License is distributed on an "AS IS" basis,
\r
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
\r
12 * for the specific language governing rights and limitations under the
\r
15 * The Original Code is Mozilla Communicator client code, released
\r
18 * The Initial Developer of the Original Code is
\r
19 * Netscape Communications Corporation.
\r
20 * Portions created by the Initial Developer are Copyright (C) 1998
\r
21 * the Initial Developer. All Rights Reserved.
\r
25 * Alternatively, the contents of this file may be used under the terms of
\r
26 * either the GNU General Public License Version 2 or later (the "GPL"), or
\r
27 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
\r
28 * in which case the provisions of the GPL or the LGPL are applicable instead
\r
29 * of those above. If you wish to allow use of your version of this file only
\r
30 * under the terms of either the GPL or the LGPL, and not to allow others to
\r
31 * use your version of this file under the terms of the MPL, indicate your
\r
32 * decision by deleting the provisions above and replace them with the notice
\r
33 * and other provisions required by the GPL or the LGPL. If you do not delete
\r
34 * the provisions above, a recipient may use your version of this file under
\r
35 * the terms of any one of the MPL, the GPL or the LGPL.
\r
37 * ***** END LICENSE BLOCK ***** */
\r
40 File Name: 15.4.1.js
\r
41 ECMA Section: 15.4.1 The Array Constructor Called as a Function
\r
43 Description: When Array is called as a function rather than as a
\r
44 constructor, it creates and initializes a new array
\r
45 object. Thus, the function call Array(...) is
\r
46 equivalent to the object creationi new Array(...) with
\r
49 Author: christine@netscape.com
\r
50 Date: 7 october 1997
\r
53 var SECTION = "15.4.1";
\r
54 var VERSION = "ECMA_1";
\r
56 var TITLE = "The Array Constructor Called as a Function";
\r
58 writeHeaderToLog( SECTION + " "+ TITLE);
\r
60 new TestCase( SECTION,
\r
65 new TestCase( SECTION,
\r
70 new TestCase( SECTION,
\r
71 "var arr = Array(); arr.getClass = Object.prototype.toString; arr.getClass()",
\r
73 eval("var arr = Array(); arr.getClass = Object.prototype.toString; arr.getClass()") );
\r
75 new TestCase( SECTION,
\r
76 "var arr = Array(); arr.toString == Array.prototype.toString",
\r
78 eval("var arr = Array(); arr.toString == Array.prototype.toString") );
\r
80 new TestCase( SECTION,
\r
85 new TestCase( SECTION,
\r
90 new TestCase( SECTION,
\r
91 "typeof Array(1,2,3)",
\r
93 typeof Array(1,2,3) );
\r
95 new TestCase( SECTION,
\r
96 "var arr = Array(1,2,3); arr.getClass = Object.prototype.toString; arr.getClass()",
\r
98 eval("var arr = Array(1,2,3); arr.getClass = Object.prototype.toString; arr.getClass()") );
\r
100 new TestCase( SECTION,
\r
101 "var arr = Array(1,2,3); arr.toString == Array.prototype.toString",
\r
103 eval("var arr = Array(1,2,3); arr.toString == Array.prototype.toString") );
\r
105 new TestCase( SECTION,
\r
106 "Array(1,2,3).length",
\r
108 Array(1,2,3).length );
\r
110 new TestCase( SECTION,
\r
111 "typeof Array(12345)",
\r
113 typeof Array(12345) );
\r
115 new TestCase( SECTION,
\r
116 "var arr = Array(12345); arr.getClass = Object.prototype.toString; arr.getClass()",
\r
118 eval("var arr = Array(12345); arr.getClass = Object.prototype.toString; arr.getClass()") );
\r
120 new TestCase( SECTION,
\r
121 "var arr = Array(1,2,3,4,5); arr.toString == Array.prototype.toString",
\r
123 eval("var arr = Array(1,2,3,4,5); arr.toString == Array.prototype.toString") );
\r
125 new TestCase( SECTION,
\r
126 "Array(12345).length",
\r
128 Array(12345).length );
\r