Merge "fix: the incorrect version of tarball generated by gbs export" into tizen
[platform/upstream/js.git] / js / src / tests / js1_5 / Array / regress-107138.js
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4  *
5  * The contents of this file are subject to the Mozilla Public License Version
6  * 1.1 (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  * http://www.mozilla.org/MPL/
9  *
10  * Software distributed under the License is distributed on an "AS IS" basis,
11  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12  * for the specific language governing rights and limitations under the
13  * License.
14  *
15  * The Original Code is mozilla.org code.
16  *
17  * The Initial Developer of the Original Code is
18  * Netscape Communications Corporation.
19  * Portions created by the Initial Developer are Copyright (C) 1998
20  * the Initial Developer. All Rights Reserved.
21  *
22  * Contributor(s):
23  *   morse@netscape.com, pschwartau@netscape.com
24  *
25  * Alternatively, the contents of this file may be used under the terms of
26  * either the GNU General Public License Version 2 or later (the "GPL"), or
27  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28  * in which case the provisions of the GPL or the LGPL are applicable instead
29  * of those above. If you wish to allow use of your version of this file only
30  * under the terms of either the GPL or the LGPL, and not to allow others to
31  * use your version of this file under the terms of the MPL, indicate your
32  * decision by deleting the provisions above and replace them with the notice
33  * and other provisions required by the GPL or the LGPL. If you do not delete
34  * the provisions above, a recipient may use your version of this file under
35  * the terms of any one of the MPL, the GPL or the LGPL.
36  *
37  * ***** END LICENSE BLOCK ***** */
38
39 /*
40  * Date: 29 October 2001
41  *
42  * SUMMARY: Regression test for bug 107138
43  * See http://bugzilla.mozilla.org/show_bug.cgi?id=107138
44  *
45  * The bug: arr['1'] == undefined instead of arr['1'] == 'one'.
46  * The bug was intermittent and did not always occur...
47  *
48  * The cnSTRESS constant defines how many times to repeat this test.
49  */
50 //-----------------------------------------------------------------------------
51 var UBound = 0;
52 var cnSTRESS = 10;
53 var cnDASH = '-';
54 var BUGNUMBER = 107138;
55 var summary = 'Regression test for bug 107138';
56 var status = '';
57 var statusitems = [];
58 var actual = '';
59 var actualvalues = [];
60 var expect= '';
61 var expectedvalues = [];
62
63
64 var arr = ['zero', 'one', 'two', 'three', 'four', 'five',
65            'six', 'seven', 'eight', 'nine', 'ten'];
66
67
68 // This bug was intermittent. Stress-test it.
69 for (var j=0; j<cnSTRESS; j++)
70 {
71   status = inSection(j + cnDASH + 1);
72   actual = arr[0];
73   expect = 'zero';
74   addThis();
75
76   status = inSection(j + cnDASH + 2);
77   actual = arr['0'];
78   expect = 'zero';
79   addThis();
80
81   status = inSection(j + cnDASH + 3);
82   actual = arr[1];
83   expect = 'one';
84   addThis();
85
86   status = inSection(j + cnDASH + 4);
87   actual = arr['1'];
88   expect = 'one';
89   addThis();
90
91   status = inSection(j + cnDASH + 5);
92   actual = arr[2];
93   expect = 'two';
94   addThis();
95
96   status = inSection(j + cnDASH + 6);
97   actual = arr['2'];
98   expect = 'two';
99   addThis();
100
101   status = inSection(j + cnDASH + 7);
102   actual = arr[3];
103   expect = 'three';
104   addThis();
105
106   status = inSection(j + cnDASH + 8);
107   actual = arr['3'];
108   expect = 'three';
109   addThis();
110
111   status = inSection(j + cnDASH + 9);
112   actual = arr[4];
113   expect = 'four';
114   addThis();
115
116   status = inSection(j + cnDASH + 10);
117   actual = arr['4'];
118   expect = 'four';
119   addThis();
120
121   status = inSection(j + cnDASH + 11);
122   actual = arr[5];
123   expect = 'five';
124   addThis();
125
126   status = inSection(j + cnDASH + 12);
127   actual = arr['5'];
128   expect = 'five';
129   addThis();
130
131   status = inSection(j + cnDASH + 13);
132   actual = arr[6];
133   expect = 'six';
134   addThis();
135
136   status = inSection(j + cnDASH + 14);
137   actual = arr['6'];
138   expect = 'six';
139   addThis();
140
141   status = inSection(j + cnDASH + 15);
142   actual = arr[7];
143   expect = 'seven';
144   addThis();
145
146   status = inSection(j + cnDASH + 16);
147   actual = arr['7'];
148   expect = 'seven';
149   addThis();
150
151   status = inSection(j + cnDASH + 17);
152   actual = arr[8];
153   expect = 'eight';
154   addThis();
155
156   status = inSection(j + cnDASH + 18);
157   actual = arr['8'];
158   expect = 'eight';
159   addThis();
160
161   status = inSection(j + cnDASH + 19);
162   actual = arr[9];
163   expect = 'nine';
164   addThis();
165
166   status = inSection(j + cnDASH + 20);
167   actual = arr['9'];
168   expect = 'nine';
169   addThis();
170
171   status = inSection(j + cnDASH + 21);
172   actual = arr[10];
173   expect = 'ten';
174   addThis();
175
176   status = inSection(j + cnDASH + 22);
177   actual = arr['10'];
178   expect = 'ten';
179   addThis();
180 }
181
182
183 //-----------------------------------------------------------------------------
184 test();
185 //-----------------------------------------------------------------------------
186
187
188
189 function addThis()
190 {
191   statusitems[UBound] = status;
192   actualvalues[UBound] = actual;
193   expectedvalues[UBound] = expect;
194   UBound++;
195 }
196
197
198 function test()
199 {
200   enterFunc ('test');
201   printBugNumber(BUGNUMBER);
202   printStatus (summary);
203
204   for (var i=0; i<UBound; i++)
205   {
206     reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
207   }
208
209   exitFunc ('test');
210 }