Debian Codegraph @

js/src/tests/non262/Array/regress-94257.js

raw
1 /* -*- indent-tabs-mode: nil; js-indent-level: 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 UBound = 0;
18 var BUGNUMBER = 94257;
19 var summary = "Making sure we don't crash on this code -";
20 var status = '';
21 var statusitems = [];
22 var actual = '';
23 var actualvalues = [];
24 var expect= '';
25 var expectedvalues = [];
26
27
28 var arr = new Array(6);
29 arr[1+1] = 1;
30 arr[1+1] += 2;
31
32
33 status = inSection(1);
34 actual = arr[1+1];
35 expect = 3;
36 addThis();
37
38 status = inSection(2);
39 actual = arr[1+1+1];
40 expect = undefined;
41 addThis();
42
43 status = inSection(3);
44 actual = arr[1];
45 expect = undefined;
46 addThis();
47
48
49 arr[1+2] = 'Hello';
50
51
52 status = inSection(4);
53 actual = arr[1+1+1];
54 expect = 'Hello';
55 addThis();
56
57
58
59 //-----------------------------------------------------------------------------
60 test();
61 //-----------------------------------------------------------------------------
62
63
64
65 function addThis()
66 {
67 statusitems[UBound] = status;
68 actualvalues[UBound] = actual;
69 expectedvalues[UBound] = expect;
70 UBound++;
71 }
72
73
74 function test()
75 {
76 printBugNumber(BUGNUMBER);
77 printStatus (summary);
78
79 for (var i=0; i<UBound; i++)
80 {
81 reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
82 }
83 }