blob: 28ab667528935f9b1de3f3b23ee2a956449b4e05 [file] [log] [blame]
The Android Open Source Project9364f222008-10-21 07:00:00 -07001/*
2* The contents of this file are subject to the Netscape Public
3* License Version 1.1 (the "License"); you may not use this file
4* except in compliance with the License. You may obtain a copy of
5* the License at http://www.mozilla.org/NPL/
6*
7* Software distributed under the License is distributed on an "AS
8* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
9* implied. See the License for the specific language governing
10* rights and limitations under the License.
11*
12* The Original Code is mozilla.org code.
13*
14* The Initial Developer of the Original Code is Netscape
15* Communications Corporation. Portions created by Netscape are
16* Copyright (C) 1998 Netscape Communications Corporation.
17* All Rights Reserved.
18*
19* Contributor(s): wtam@bigfoot.com, pschwartau@netscape.com
20* Date: 30 October 2001
21*
22* SUMMARY: Regression test for bug 94257
23* See http://bugzilla.mozilla.org/show_bug.cgi?id=94257
24*
25* Rhino used to crash on this code; specifically, on the line
26*
27* arr[1+1] += 2;
28*/
29//-----------------------------------------------------------------------------
30var UBound = 0;
31var bug = 94257;
32var summary = "Making sure we don't crash on this code -";
33var status = '';
34var statusitems = [];
35var actual = '';
36var actualvalues = [];
37var expect= '';
38var expectedvalues = [];
39
40
41var arr = new Array(6);
42arr[1+1] = 1;
43arr[1+1] += 2;
44
45
46status = inSection(1);
47actual = arr[1+1];
48expect = 3;
49addThis();
50
51status = inSection(2);
52actual = arr[1+1+1];
53expect = undefined;
54addThis();
55
56status = inSection(3);
57actual = arr[1];
58expect = undefined;
59addThis();
60
61
62arr[1+2] = 'Hello';
63
64
65status = inSection(4);
66actual = arr[1+1+1];
67expect = 'Hello';
68addThis();
69
70
71
72//-----------------------------------------------------------------------------
73test();
74//-----------------------------------------------------------------------------
75
76
77
78function addThis()
79{
80 statusitems[UBound] = status;
81 actualvalues[UBound] = actual;
82 expectedvalues[UBound] = expect;
83 UBound++;
84}
85
86
87function test()
88{
89 enterFunc ('test');
90 printBugNumber (bug);
91 printStatus (summary);
92
93 for (var i=0; i<UBound; i++)
94 {
95 reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
96 }
97
98 exitFunc ('test');
99}