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

« back to all changes in this revision

Viewing changes to js/src/tests/ecma/Array/15.4.5.2-1.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.5.2-1.js
 
9
   ECMA Section:       Array.length
 
10
   Description:
 
11
   15.4.5.2 length
 
12
   The length property of this Array object is always numerically greater
 
13
   than the name of every property whose name is an array index.
 
14
 
 
15
   The length property has the attributes { DontEnum, DontDelete }.
 
16
   Author:             christine@netscape.com
 
17
   Date:               12 november 1997
 
18
*/
 
19
 
 
20
var SECTION = "15.4.5.2-1";
 
21
var VERSION = "ECMA_1";
 
22
startTest();
 
23
var TITLE   = "Array.length";
 
24
 
 
25
writeHeaderToLog( SECTION + " "+ TITLE);
 
26
 
 
27
new TestCase(   SECTION,
 
28
                "var A = new Array(); A.length",
 
29
                0,
 
30
                eval("var A = new Array(); A.length") );
 
31
new TestCase(   SECTION,
 
32
                "var A = new Array(); A[Math.pow(2,32)-2] = 'hi'; A.length",
 
33
                Math.pow(2,32)-1,
 
34
                eval("var A = new Array(); A[Math.pow(2,32)-2] = 'hi'; A.length") );
 
35
new TestCase(   SECTION,
 
36
                "var A = new Array(); A.length = 123; A.length",
 
37
                123,
 
38
                eval("var A = new Array(); A.length = 123; A.length") );
 
39
new TestCase(   SECTION,
 
40
                "var A = new Array(); A.length = 123; var PROPS = ''; for ( var p in A ) { PROPS += ( p == 'length' ? p : ''); } PROPS",
 
41
                "",
 
42
                eval("var A = new Array(); A.length = 123; var PROPS = ''; for ( var p in A ) { PROPS += ( p == 'length' ? p : ''); } PROPS") );
 
43
new TestCase(   SECTION,
 
44
                "var A = new Array(); A.length = 123; delete A.length",
 
45
                false ,
 
46
                eval("var A = new Array(); A.length = 123; delete A.length") );
 
47
new TestCase(   SECTION,
 
48
                "var A = new Array(); A.length = 123; delete A.length; A.length",
 
49
                123,
 
50
                eval("var A = new Array(); A.length = 123; delete A.length; A.length") );
 
51
test();
 
52