]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/ecma/Array/15.4.2.3.js
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.3.js
24 ECMA Section: 15.4.2.3 new Array()
25 Description: The [[Prototype]] property of the newly constructed
26 object is set to the origianl Array prototype object,
27 the one that is the initial value of Array.prototype.
28 The [[Class]] property of the new object is set to
29 "Array". The length of the object is set to 0.
31 Author: christine@netscape.com
35 var SECTION
= "15.4.2.3";
36 var VERSION
= "ECMA_1";
38 var TITLE
= "The Array Constructor: new Array()";
40 writeHeaderToLog( SECTION
+ " "+ TITLE
);
42 var testcases
= getTestCases();
45 function getTestCases() {
46 var array
= new Array();
48 array
[item
++] = new TestCase( SECTION
, "new Array() +''", "", (new Array()) +"" );
49 array
[item
++] = new TestCase( SECTION
, "typeof new Array()", "object", (typeof new Array()) );
50 array
[item
++] = new TestCase( SECTION
,
51 "var arr = new Array(); arr.getClass = Object.prototype.toString; arr.getClass()",
53 eval("var arr = new Array(); arr.getClass = Object.prototype.toString; arr.getClass()") );
55 array
[item
++] = new TestCase( SECTION
, "(new Array()).length", 0, (new Array()).length
);
56 array
[item
++] = new TestCase( SECTION
, "(new Array()).toString == Array.prototype.toString", true, (new Array()).toString
== Array
.prototype.toString
);
57 array
[item
++] = new TestCase( SECTION
, "(new Array()).join == Array.prototype.join", true, (new Array()).join
== Array
.prototype.join
);
58 array
[item
++] = new TestCase( SECTION
, "(new Array()).reverse == Array.prototype.reverse", true, (new Array()).reverse
== Array
.prototype.reverse
);
59 array
[item
++] = new TestCase( SECTION
, "(new Array()).sort == Array.prototype.sort", true, (new Array()).sort
== Array
.prototype.sort
);
64 for ( tc
=0; tc
< testcases
.length
; tc
++ ) {
65 testcases
[tc
].passed
= writeTestCaseResult(
68 testcases
[tc
].description
+" = "+ testcases
[tc
].actual
);
70 testcases
[tc
].reason
+= ( testcases
[tc
].passed
) ? "" : "wrong value ";