js/src/tests/ecma/Array/15.4.2.3.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.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6
michael@0 7 /**
michael@0 8 File Name: 15.4.2.3.js
michael@0 9 ECMA Section: 15.4.2.3 new Array()
michael@0 10 Description: The [[Prototype]] property of the newly constructed
michael@0 11 object is set to the origianl Array prototype object,
michael@0 12 the one that is the initial value of Array.prototype.
michael@0 13 The [[Class]] property of the new object is set to
michael@0 14 "Array". The length of the object is set to 0.
michael@0 15
michael@0 16 Author: christine@netscape.com
michael@0 17 Date: 7 october 1997
michael@0 18 */
michael@0 19
michael@0 20 var SECTION = "15.4.2.3";
michael@0 21 var VERSION = "ECMA_1";
michael@0 22 startTest();
michael@0 23 var TITLE = "The Array Constructor: new Array()";
michael@0 24
michael@0 25 writeHeaderToLog( SECTION + " "+ TITLE);
michael@0 26
michael@0 27 new TestCase( SECTION,
michael@0 28 "new Array() +''",
michael@0 29 "",
michael@0 30 (new Array()) +"" );
michael@0 31
michael@0 32 new TestCase( SECTION,
michael@0 33 "typeof new Array()",
michael@0 34 "object",
michael@0 35 (typeof new Array()) );
michael@0 36
michael@0 37 new TestCase( SECTION,
michael@0 38 "var arr = new Array(); arr.getClass = Object.prototype.toString; arr.getClass()",
michael@0 39 "[object Array]",
michael@0 40 eval("var arr = new Array(); arr.getClass = Object.prototype.toString; arr.getClass()") );
michael@0 41
michael@0 42 new TestCase( SECTION,
michael@0 43 "(new Array()).length",
michael@0 44 0,
michael@0 45 (new Array()).length );
michael@0 46
michael@0 47 new TestCase( SECTION,
michael@0 48 "(new Array()).toString == Array.prototype.toString",
michael@0 49 true,
michael@0 50 (new Array()).toString == Array.prototype.toString );
michael@0 51
michael@0 52 new TestCase( SECTION,
michael@0 53 "(new Array()).join == Array.prototype.join",
michael@0 54 true,
michael@0 55 (new Array()).join == Array.prototype.join );
michael@0 56
michael@0 57 new TestCase( SECTION,
michael@0 58 "(new Array()).reverse == Array.prototype.reverse",
michael@0 59 true,
michael@0 60 (new Array()).reverse == Array.prototype.reverse );
michael@0 61
michael@0 62 new TestCase( SECTION,
michael@0 63 "(new Array()).sort == Array.prototype.sort",
michael@0 64 true,
michael@0 65 (new Array()).sort == Array.prototype.sort );
michael@0 66
michael@0 67 test();

mercurial