Debian Codegraph @

rhino/testsrc/tests/ecma/Array/15.4.5.2-1.js

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