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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/ecma/Array/15.4.2.3.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,67 @@
     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.3.js
    1.12 +   ECMA Section:       15.4.2.3 new Array()
    1.13 +   Description:        The [[Prototype]] property of the newly constructed
    1.14 +   object is set to the origianl Array prototype object,
    1.15 +   the one that is the initial value of Array.prototype.
    1.16 +   The [[Class]] property of the new object is set to
    1.17 +   "Array".  The length of the object is set to 0.
    1.18 +
    1.19 +   Author:             christine@netscape.com
    1.20 +   Date:               7 october 1997
    1.21 +*/
    1.22 +
    1.23 +var SECTION = "15.4.2.3";
    1.24 +var VERSION = "ECMA_1";
    1.25 +startTest();
    1.26 +var TITLE   = "The Array Constructor:  new Array()";
    1.27 +
    1.28 +writeHeaderToLog( SECTION + " "+ TITLE);
    1.29 +
    1.30 +new TestCase( SECTION,
    1.31 +	      "new   Array() +''",       
    1.32 +	      "",                
    1.33 +	      (new Array()) +"" );
    1.34 +
    1.35 +new TestCase( SECTION,
    1.36 +	      "typeof new Array()",      
    1.37 +	      "object",          
    1.38 +	      (typeof new Array()) );
    1.39 +
    1.40 +new TestCase( SECTION,
    1.41 +	      "var arr = new Array(); arr.getClass = Object.prototype.toString; arr.getClass()",
    1.42 +	      "[object Array]",
    1.43 +	      eval("var arr = new Array(); arr.getClass = Object.prototype.toString; arr.getClass()") );
    1.44 +
    1.45 +new TestCase( SECTION,
    1.46 +	      "(new Array()).length",    
    1.47 +	      0,                 
    1.48 +	      (new Array()).length );
    1.49 +
    1.50 +new TestCase( SECTION,
    1.51 +	      "(new Array()).toString == Array.prototype.toString",  
    1.52 +	      true,      
    1.53 +	      (new Array()).toString == Array.prototype.toString );
    1.54 +
    1.55 +new TestCase( SECTION,
    1.56 +	      "(new Array()).join  == Array.prototype.join",         
    1.57 +	      true,      
    1.58 +	      (new Array()).join  == Array.prototype.join );
    1.59 +
    1.60 +new TestCase( SECTION,
    1.61 +	      "(new Array()).reverse == Array.prototype.reverse",    
    1.62 +	      true,      
    1.63 +	      (new Array()).reverse  == Array.prototype.reverse );
    1.64 +
    1.65 +new TestCase( SECTION,
    1.66 +	      "(new Array()).sort  == Array.prototype.sort",        
    1.67 +	      true,      
    1.68 +	      (new Array()).sort  == Array.prototype.sort );
    1.69 +
    1.70 +test();

mercurial