1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/ecma/Array/15.4.2.2-2.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,84 @@ 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.2.2-2.js 1.12 + ECMA Section: 15.4.2.2 new Array(len) 1.13 + 1.14 + Description: This description only applies of the constructor is 1.15 + given two or more arguments. 1.16 + 1.17 + The [[Prototype]] property of the newly constructed 1.18 + object is set to the original Array prototype object, 1.19 + the one that is the initial value of Array.prototype(0) 1.20 + (15.4.3.1). 1.21 + 1.22 + The [[Class]] property of the newly constructed object 1.23 + is set to "Array". 1.24 + 1.25 + If the argument len is a number, then the length 1.26 + property of the newly constructed object is set to 1.27 + ToUint32(len). 1.28 + 1.29 + If the argument len is not a number, then the length 1.30 + property of the newly constructed object is set to 1 1.31 + and the 0 property of the newly constructed object is 1.32 + set to len. 1.33 + 1.34 + This file tests length of the newly constructed array 1.35 + when len is not a number. 1.36 + 1.37 + Author: christine@netscape.com 1.38 + Date: 7 october 1997 1.39 +*/ 1.40 +var SECTION = "15.4.2.2-2"; 1.41 +var VERSION = "ECMA_1"; 1.42 +startTest(); 1.43 +var TITLE = "The Array Constructor: new Array( len )"; 1.44 + 1.45 +writeHeaderToLog( SECTION + " "+ TITLE); 1.46 + 1.47 +new TestCase( SECTION, 1.48 + "(new Array(new Number(1073741823))).length", 1.49 + 1, 1.50 + (new Array(new Number(1073741823))).length ); 1.51 + 1.52 +new TestCase( SECTION, 1.53 + "(new Array(new Number(0))).length", 1.54 + 1, 1.55 + (new Array(new Number(0))).length ); 1.56 + 1.57 +new TestCase( SECTION, 1.58 + "(new Array(new Number(1000))).length", 1.59 + 1, 1.60 + (new Array(new Number(1000))).length ); 1.61 + 1.62 +new TestCase( SECTION, 1.63 + "(new Array('mozilla, larryzilla, curlyzilla')).length", 1.64 + 1, 1.65 + (new Array('mozilla, larryzilla, curlyzilla')).length ); 1.66 + 1.67 +new TestCase( SECTION, 1.68 + "(new Array(true)).length", 1.69 + 1, 1.70 + (new Array(true)).length ); 1.71 + 1.72 +new TestCase( SECTION, 1.73 + "(new Array(false)).length", 1.74 + 1, 1.75 + (new Array(false)).length); 1.76 + 1.77 +new TestCase( SECTION, 1.78 + "(new Array(new Boolean(true)).length", 1.79 + 1, 1.80 + (new Array(new Boolean(true))).length ); 1.81 + 1.82 +new TestCase( SECTION, 1.83 + "(new Array(new Boolean(false)).length", 1.84 + 1, 1.85 + (new Array(new Boolean(false))).length ); 1.86 + 1.87 +test();