Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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/. */
7 /**
8 File Name: 15.4.1.js
9 ECMA Section: 15.4.1 The Array Constructor Called as a Function
11 Description: When Array is called as a function rather than as a
12 constructor, it creates and initializes a new array
13 object. Thus, the function call Array(...) is
14 equivalent to the object creationi new Array(...) with
15 the same arguments.
17 Author: christine@netscape.com
18 Date: 7 october 1997
19 */
21 var SECTION = "15.4.1";
22 var VERSION = "ECMA_1";
23 startTest();
24 var TITLE = "The Array Constructor Called as a Function";
26 writeHeaderToLog( SECTION + " "+ TITLE);
28 new TestCase( SECTION,
29 "Array() +''",
30 "",
31 Array() +"" );
33 new TestCase( SECTION,
34 "typeof Array()",
35 "object",
36 typeof Array() );
38 new TestCase( SECTION,
39 "var arr = Array(); arr.getClass = Object.prototype.toString; arr.getClass()",
40 "[object Array]",
41 eval("var arr = Array(); arr.getClass = Object.prototype.toString; arr.getClass()") );
43 new TestCase( SECTION,
44 "var arr = Array(); arr.toString == Array.prototype.toString",
45 true,
46 eval("var arr = Array(); arr.toString == Array.prototype.toString") );
48 new TestCase( SECTION,
49 "Array().length",
50 0,
51 Array().length );
53 new TestCase( SECTION,
54 "Array(1,2,3) +''",
55 "1,2,3",
56 Array(1,2,3) +"" );
58 new TestCase( SECTION,
59 "typeof Array(1,2,3)",
60 "object",
61 typeof Array(1,2,3) );
63 new TestCase( SECTION,
64 "var arr = Array(1,2,3); arr.getClass = Object.prototype.toString; arr.getClass()",
65 "[object Array]",
66 eval("var arr = Array(1,2,3); arr.getClass = Object.prototype.toString; arr.getClass()") );
68 new TestCase( SECTION,
69 "var arr = Array(1,2,3); arr.toString == Array.prototype.toString",
70 true,
71 eval("var arr = Array(1,2,3); arr.toString == Array.prototype.toString") );
73 new TestCase( SECTION,
74 "Array(1,2,3).length",
75 3,
76 Array(1,2,3).length );
78 new TestCase( SECTION,
79 "typeof Array(12345)",
80 "object",
81 typeof Array(12345) );
83 new TestCase( SECTION,
84 "var arr = Array(12345); arr.getClass = Object.prototype.toString; arr.getClass()",
85 "[object Array]",
86 eval("var arr = Array(12345); arr.getClass = Object.prototype.toString; arr.getClass()") );
88 new TestCase( SECTION,
89 "var arr = Array(1,2,3,4,5); arr.toString == Array.prototype.toString",
90 true,
91 eval("var arr = Array(1,2,3,4,5); arr.toString == Array.prototype.toString") );
93 new TestCase( SECTION,
94 "Array(12345).length",
95 12345,
96 Array(12345).length );
98 test();