Debian Codegraph @

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