~ubuntu-branches/ubuntu/saucy/mozjs17/saucy

« back to all changes in this revision

Viewing changes to js/src/tests/ecma/Array/15.4.2.3.js

  • Committer: Package Import Robot
  • Author(s): Rico Tzschichholz
  • Date: 2013-05-25 12:24:23 UTC
  • Revision ID: package-import@ubuntu.com-20130525122423-zmxucrhtensw90xy
Tags: upstream-17.0.0
ImportĀ upstreamĀ versionĀ 17.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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/. */
 
5
 
 
6
 
 
7
/**
 
8
   File Name:          15.4.2.3.js
 
9
   ECMA Section:       15.4.2.3 new Array()
 
10
   Description:        The [[Prototype]] property of the newly constructed
 
11
   object is set to the origianl Array prototype object,
 
12
   the one that is the initial value of Array.prototype.
 
13
   The [[Class]] property of the new object is set to
 
14
   "Array".  The length of the object is set to 0.
 
15
 
 
16
   Author:             christine@netscape.com
 
17
   Date:               7 october 1997
 
18
*/
 
19
 
 
20
var SECTION = "15.4.2.3";
 
21
var VERSION = "ECMA_1";
 
22
startTest();
 
23
var TITLE   = "The Array Constructor:  new Array()";
 
24
 
 
25
writeHeaderToLog( SECTION + " "+ TITLE);
 
26
 
 
27
new TestCase( SECTION,
 
28
              "new   Array() +''",       
 
29
              "",                
 
30
              (new Array()) +"" );
 
31
 
 
32
new TestCase( SECTION,
 
33
              "typeof new Array()",      
 
34
              "object",          
 
35
              (typeof new Array()) );
 
36
 
 
37
new TestCase( SECTION,
 
38
              "var arr = new Array(); arr.getClass = Object.prototype.toString; arr.getClass()",
 
39
              "[object Array]",
 
40
              eval("var arr = new Array(); arr.getClass = Object.prototype.toString; arr.getClass()") );
 
41
 
 
42
new TestCase( SECTION,
 
43
              "(new Array()).length",    
 
44
              0,                 
 
45
              (new Array()).length );
 
46
 
 
47
new TestCase( SECTION,
 
48
              "(new Array()).toString == Array.prototype.toString",  
 
49
              true,      
 
50
              (new Array()).toString == Array.prototype.toString );
 
51
 
 
52
new TestCase( SECTION,
 
53
              "(new Array()).join  == Array.prototype.join",         
 
54
              true,      
 
55
              (new Array()).join  == Array.prototype.join );
 
56
 
 
57
new TestCase( SECTION,
 
58
              "(new Array()).reverse == Array.prototype.reverse",    
 
59
              true,      
 
60
              (new Array()).reverse  == Array.prototype.reverse );
 
61
 
 
62
new TestCase( SECTION,
 
63
              "(new Array()).sort  == Array.prototype.sort",        
 
64
              true,      
 
65
              (new Array()).sort  == Array.prototype.sort );
 
66
 
 
67
test();