1 /* The contents of this file are subject to the Netscape Public
2 * License Version 1.1 (the "License"); you may not use this file
3 * except in compliance with the License. You may obtain a copy of
4 * the License at http://www.mozilla.org/NPL/
6 * Software distributed under the License is distributed on an "AS
7 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
8 * implied. See the License for the specific language governing
9 * rights and limitations under the License.
11 * The Original Code is Mozilla Communicator client code, released March
14 * The Initial Developer of the Original Code is Netscape Communications
15 * Corporation. Portions created by Netscape are
16 * Copyright (C) 1998 Netscape Communications Corporation. All
23 File Name: 15.4.2.2-2.js
24 ECMA Section: 15.4.2.2 new Array(len)
26 Description: This description only applies of the constructor is
27 given two or more arguments.
29 The [[Prototype]] property of the newly constructed
30 object is set to the original Array prototype object,
31 the one that is the initial value of Array.prototype(0)
34 The [[Class]] property of the newly constructed object
37 If the argument len is a number, then the length
38 property of the newly constructed object is set to
41 If the argument len is not a number, then the length
42 property of the newly constructed object is set to 1
43 and the 0 property of the newly constructed object is
46 This file tests length of the newly constructed array
47 when len is not a number.
49 Author: christine@netscape.com
52 var SECTION = "15.4.2.2-2";
53 var VERSION = "ECMA_1";
55 var TITLE = "The Array Constructor: new Array( len )";
57 writeHeaderToLog( SECTION + " "+ TITLE);
59 var testcases = getTestCases();
62 function getTestCases() {
63 var array = new Array();
66 array[item++] = new TestCase( SECTION, "(new Array(new Number(1073741823))).length", 1, (new Array(new Number(1073741823))).length );
67 array[item++] = new TestCase( SECTION, "(new Array(new Number(0))).length", 1, (new Array(new Number(0))).length );
68 array[item++] = new TestCase( SECTION, "(new Array(new Number(1000))).length", 1, (new Array(new Number(1000))).length );
69 array[item++] = new TestCase( SECTION, "(new Array('mozilla, larryzilla, curlyzilla')).length", 1, (new Array('mozilla, larryzilla, curlyzilla')).length );
70 array[item++] = new TestCase( SECTION, "(new Array(true)).length", 1, (new Array(true)).length );
71 array[item++] = new TestCase( SECTION, "(new Array(false)).length", 1, (new Array(false)).length);
72 array[item++] = new TestCase( SECTION, "(new Array(new Boolean(true)).length", 1, (new Array(new Boolean(true))).length );
73 array[item++] = new TestCase( SECTION, "(new Array(new Boolean(false)).length", 1, (new Array(new Boolean(false))).length );
77 for ( tc=0; tc < testcases.length; tc++ ) {
78 testcases[tc].passed = writeTestCaseResult(
81 testcases[tc].description +" = "+
82 testcases[tc].actual );
83 testcases[tc].reason += ( testcases[tc].passed )