1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/ecma/Array/15.4.1.3.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,50 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 + 1.10 +/** 1.11 + File Name: 15.4.1.3.js 1.12 + ECMA Section: 15.4.1.3 Array() 1.13 + 1.14 + Description: When Array is called as a function rather than as a 1.15 + constructor, it creates and initializes a new array 1.16 + object. Thus, the function call Array(...) is 1.17 + equivalent to the object creationi new Array(...) with 1.18 + the same arguments. 1.19 + 1.20 + An array is created and returned as if by the 1.21 + expression new Array(len). 1.22 + 1.23 + Author: christine@netscape.com 1.24 + Date: 7 october 1997 1.25 +*/ 1.26 +var SECTION = "15.4.1.3"; 1.27 +var VERSION = "ECMA_1"; 1.28 +startTest(); 1.29 +var TITLE = "Array Constructor Called as a Function: Array()"; 1.30 + 1.31 +writeHeaderToLog( SECTION + " "+ TITLE); 1.32 + 1.33 +new TestCase( SECTION, 1.34 + "typeof Array()", 1.35 + "object", 1.36 + typeof Array() ); 1.37 + 1.38 +new TestCase( SECTION, 1.39 + "MYARR = new Array();MYARR.getClass = Object.prototype.toString;MYARR.getClass()", 1.40 + "[object Array]", 1.41 + eval("MYARR = Array();MYARR.getClass = Object.prototype.toString;MYARR.getClass()") ); 1.42 + 1.43 +new TestCase( SECTION, 1.44 + "(Array()).length", 1.45 + 0, 1.46 + (Array()).length ); 1.47 + 1.48 +new TestCase( SECTION, 1.49 + "Array().toString()", 1.50 + "", 1.51 + Array().toString() ); 1.52 + 1.53 +test();