js/src/tests/ecma/Array/15.4.2.2-2.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

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.2.2-2.js
     9    ECMA Section:       15.4.2.2 new Array(len)
    11    Description:        This description only applies of the constructor is
    12    given two or more arguments.
    14    The [[Prototype]] property of the newly constructed
    15    object is set to the original Array prototype object,
    16    the one that is the initial value of Array.prototype(0)
    17    (15.4.3.1).
    19    The [[Class]] property of the newly constructed object
    20    is set to "Array".
    22    If the argument len is a number, then the length
    23    property  of the newly constructed object is set to
    24    ToUint32(len).
    26    If the argument len is not a number, then the length
    27    property of the newly constructed object is set to 1
    28    and the 0 property of the newly constructed object is
    29    set to len.
    31    This file tests length of the newly constructed array
    32    when len is not a number.
    34    Author:             christine@netscape.com
    35    Date:               7 october 1997
    36 */
    37 var SECTION = "15.4.2.2-2";
    38 var VERSION = "ECMA_1";
    39 startTest();
    40 var TITLE   = "The Array Constructor:  new Array( len )";
    42 writeHeaderToLog( SECTION + " "+ TITLE);
    44 new TestCase( SECTION,
    45 	      "(new Array(new Number(1073741823))).length",  
    46 	      1,     
    47 	      (new Array(new Number(1073741823))).length );
    49 new TestCase( SECTION,
    50 	      "(new Array(new Number(0))).length",           
    51 	      1,     
    52 	      (new Array(new Number(0))).length );
    54 new TestCase( SECTION,
    55 	      "(new Array(new Number(1000))).length",        
    56 	      1,     
    57 	      (new Array(new Number(1000))).length );
    59 new TestCase( SECTION,
    60 	      "(new Array('mozilla, larryzilla, curlyzilla')).length",
    61 	      1, 
    62 	      (new Array('mozilla, larryzilla, curlyzilla')).length );
    64 new TestCase( SECTION,
    65 	      "(new Array(true)).length",                    
    66 	      1,     
    67 	      (new Array(true)).length );
    69 new TestCase( SECTION,
    70 	      "(new Array(false)).length",                   
    71 	      1,     
    72 	      (new Array(false)).length);
    74 new TestCase( SECTION,
    75 	      "(new Array(new Boolean(true)).length",        
    76 	      1,     
    77 	      (new Array(new Boolean(true))).length );
    79 new TestCase( SECTION,
    80 	      "(new Array(new Boolean(false)).length",       
    81 	      1,     
    82 	      (new Array(new Boolean(false))).length );
    84 test();

mercurial