Debian Codegraph @

rhino/testsrc/tests/js1_5/Array/regress-350256-01.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 var gTestfile = 'regress-350256-01.js';
7 //-----------------------------------------------------------------------------
8 var BUGNUMBER = 350256;
9 var summary = 'Array.apply maximum arguments: 2^16';
10 var actual = '';
11 var expect = '';
12
13
14 //-----------------------------------------------------------------------------
15 test(Math.pow(2, 16));
16 //-----------------------------------------------------------------------------
17
18 function test(length)
19 {
20 enterFunc ('test');
21 printBugNumber(BUGNUMBER);
22 printStatus (summary);
23
24
25 var a = new Array();
26 a[length - 2] = 'length-2';
27 a[length - 1] = 'length-1';
28
29 var b = Array.apply(null, a);
30
31 expect = length + ',length-2,length-1';
32 actual = b.length + "," + b[length - 2] + "," + b[length - 1];
33 reportCompare(expect, actual, summary);
34
35 function f() {
36 return arguments.length + "," + arguments[length - 2] + "," +
37 arguments[length - 1];
38 }
39
40 expect = length + ',length-2,length-1';
41 actual = f.apply(null, a);
42
43 reportCompare(expect, actual, summary);
44
45 exitFunc ('test');
46 }