Debian Codegraph @

rhino/testsrc/tests/js1_5/Array/regress-94257.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 /*
7 * Date: 30 October 2001
8 *
9 * SUMMARY: Regression test for bug 94257
10 * See http://bugzilla.mozilla.org/show_bug.cgi?id=94257
11 *
12 * Rhino used to crash on this code; specifically, on the line
13 *
14 * arr[1+1] += 2;
15 */
16 //-----------------------------------------------------------------------------
17 var gTestfile = 'regress-94257.js';
18 var UBound = 0;
19 var BUGNUMBER = 94257;
20 var summary = "Making sure we don't crash on this code -";
21 var status = '';
22 var statusitems = [];
23 var actual = '';
24 var actualvalues = [];
25 var expect= '';
26 var expectedvalues = [];
27
28
29 var arr = new Array(6);
30 arr[1+1] = 1;
31 arr[1+1] += 2;
32
33
34 status = inSection(1);
35 actual = arr[1+1];
36 expect = 3;
37 addThis();
38
39 status = inSection(2);
40 actual = arr[1+1+1];
41 expect = undefined;
42 addThis();
43
44 status = inSection(3);
45 actual = arr[1];
46 expect = undefined;
47 addThis();
48
49
50 arr[1+2] = 'Hello';
51
52
53 status = inSection(4);
54 actual = arr[1+1+1];
55 expect = 'Hello';
56 addThis();
57
58
59
60 //-----------------------------------------------------------------------------
61 test();
62 //-----------------------------------------------------------------------------
63
64
65
66 function addThis()
67 {
68 statusitems[UBound] = status;
69 actualvalues[UBound] = actual;
70 expectedvalues[UBound] = expect;
71 UBound++;
72 }
73
74
75 function test()
76 {
77 enterFunc ('test');
78 printBugNumber(BUGNUMBER);
79 printStatus (summary);
80
81 for (var i=0; i<UBound; i++)
82 {
83 reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
84 }
85
86 exitFunc ('test');
87 }