js/src/tests/ecma/Array/15.4.2.3.js

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:fc2766dde4a2
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.3.js
9 ECMA Section: 15.4.2.3 new Array()
10 Description: The [[Prototype]] property of the newly constructed
11 object is set to the origianl Array prototype object,
12 the one that is the initial value of Array.prototype.
13 The [[Class]] property of the new object is set to
14 "Array". The length of the object is set to 0.
15
16 Author: christine@netscape.com
17 Date: 7 october 1997
18 */
19
20 var SECTION = "15.4.2.3";
21 var VERSION = "ECMA_1";
22 startTest();
23 var TITLE = "The Array Constructor: new Array()";
24
25 writeHeaderToLog( SECTION + " "+ TITLE);
26
27 new TestCase( SECTION,
28 "new Array() +''",
29 "",
30 (new Array()) +"" );
31
32 new TestCase( SECTION,
33 "typeof new Array()",
34 "object",
35 (typeof new Array()) );
36
37 new TestCase( SECTION,
38 "var arr = new Array(); arr.getClass = Object.prototype.toString; arr.getClass()",
39 "[object Array]",
40 eval("var arr = new Array(); arr.getClass = Object.prototype.toString; arr.getClass()") );
41
42 new TestCase( SECTION,
43 "(new Array()).length",
44 0,
45 (new Array()).length );
46
47 new TestCase( SECTION,
48 "(new Array()).toString == Array.prototype.toString",
49 true,
50 (new Array()).toString == Array.prototype.toString );
51
52 new TestCase( SECTION,
53 "(new Array()).join == Array.prototype.join",
54 true,
55 (new Array()).join == Array.prototype.join );
56
57 new TestCase( SECTION,
58 "(new Array()).reverse == Array.prototype.reverse",
59 true,
60 (new Array()).reverse == Array.prototype.reverse );
61
62 new TestCase( SECTION,
63 "(new Array()).sort == Array.prototype.sort",
64 true,
65 (new Array()).sort == Array.prototype.sort );
66
67 test();

mercurial