Debian Codegraph @

rhino/testsrc/tests/ecma/Array/15.4.2.2-2.js

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