|
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.2.2-2.js |
|
9 ECMA Section: 15.4.2.2 new Array(len) |
|
10 |
|
11 Description: This description only applies of the constructor is |
|
12 given two or more arguments. |
|
13 |
|
14 The [[Prototype]] property of the newly constructed |
|
15 object is set to the original Array prototype object, |
|
16 the one that is the initial value of Array.prototype(0) |
|
17 (15.4.3.1). |
|
18 |
|
19 The [[Class]] property of the newly constructed object |
|
20 is set to "Array". |
|
21 |
|
22 If the argument len is a number, then the length |
|
23 property of the newly constructed object is set to |
|
24 ToUint32(len). |
|
25 |
|
26 If the argument len is not a number, then the length |
|
27 property of the newly constructed object is set to 1 |
|
28 and the 0 property of the newly constructed object is |
|
29 set to len. |
|
30 |
|
31 This file tests length of the newly constructed array |
|
32 when len is not a number. |
|
33 |
|
34 Author: christine@netscape.com |
|
35 Date: 7 october 1997 |
|
36 */ |
|
37 var SECTION = "15.4.2.2-2"; |
|
38 var VERSION = "ECMA_1"; |
|
39 startTest(); |
|
40 var TITLE = "The Array Constructor: new Array( len )"; |
|
41 |
|
42 writeHeaderToLog( SECTION + " "+ TITLE); |
|
43 |
|
44 new TestCase( SECTION, |
|
45 "(new Array(new Number(1073741823))).length", |
|
46 1, |
|
47 (new Array(new Number(1073741823))).length ); |
|
48 |
|
49 new TestCase( SECTION, |
|
50 "(new Array(new Number(0))).length", |
|
51 1, |
|
52 (new Array(new Number(0))).length ); |
|
53 |
|
54 new TestCase( SECTION, |
|
55 "(new Array(new Number(1000))).length", |
|
56 1, |
|
57 (new Array(new Number(1000))).length ); |
|
58 |
|
59 new TestCase( SECTION, |
|
60 "(new Array('mozilla, larryzilla, curlyzilla')).length", |
|
61 1, |
|
62 (new Array('mozilla, larryzilla, curlyzilla')).length ); |
|
63 |
|
64 new TestCase( SECTION, |
|
65 "(new Array(true)).length", |
|
66 1, |
|
67 (new Array(true)).length ); |
|
68 |
|
69 new TestCase( SECTION, |
|
70 "(new Array(false)).length", |
|
71 1, |
|
72 (new Array(false)).length); |
|
73 |
|
74 new TestCase( SECTION, |
|
75 "(new Array(new Boolean(true)).length", |
|
76 1, |
|
77 (new Array(new Boolean(true))).length ); |
|
78 |
|
79 new TestCase( SECTION, |
|
80 "(new Array(new Boolean(false)).length", |
|
81 1, |
|
82 (new Array(new Boolean(false))).length ); |
|
83 |
|
84 test(); |