Bug 1921963 part 1 - Use JS::ReportUncatchableException more outside the JS engine...
[gecko.git] / js / src / tests / non262 / regress / regress-203841.js
blob022bf537fcfaa8a11d47a1504d49ae6e8edc8030
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/. */
6 /*
7  *
8  * Date:    29 April 2003
9  * SUMMARY: Testing merged if-clauses
10  *
11  * See http://bugzilla.mozilla.org/show_bug.cgi?id=203841
12  *
13  */
14 //-----------------------------------------------------------------------------
15 var UBound = 0;
16 var BUGNUMBER = 203841;
17 var summary = 'Testing merged if-clauses';
18 var status = '';
19 var statusitems = [];
20 var actual = '';
21 var actualvalues = [];
22 var expect= '';
23 var expectedvalues = [];
26 status = inSection(1);
27 var a = 0;
28 var b = 0;
29 var c = 0;
30 if (a == 5, b == 6) { c = 1; }
31 actual = c;
32 expect = 0;
33 addThis();
35 status = inSection(2);
36 a = 5;
37 b = 0;
38 c = 0;
39 if (a == 5, b == 6) { c = 1; }
40 actual = c;
41 expect = 0;
42 addThis();
44 status = inSection(3);
45 a = 5;
46 b = 6;
47 c = 0;
48 if (a == 5, b == 6) { c = 1; }
49 actual = c;
50 expect = 1;
51 addThis();
54  * Now get tricky and use the = operator inside the if-clause
55  */
56 status = inSection(4);
57 a = 0;
58 b = 6;
59 c = 0;
60 if (a = 5, b == 6) { c = 1; }
61 actual = c;
62 expect = 1;
63 addThis();
65 status = inSection(5);
66 c = 0;
67 if (1, 1 == 6) { c = 1; }
68 actual = c;
69 expect = 0;
70 addThis();
74  * Now some tests involving arrays
75  */
76 var x=[];
78 status = inSection(6); // get element case
79 c = 0;
80 if (x[1==2]) { c = 1; }
81 actual = c;
82 expect = 0;
83 addThis();
85 status = inSection(7); // set element case
86 c = 0;
87 if (x[1==2]=1) { c = 1; }
88 actual = c;
89 expect = 1;
90 addThis();
92 status = inSection(8); // delete element case
93 c = 0;
94 if (delete x[1==2]) { c = 1; }
95 actual = c;
96 expect = 1;
97 addThis();
102 //-----------------------------------------------------------------------------
103 test();
104 //-----------------------------------------------------------------------------
109 function addThis()
111   statusitems[UBound] = status;
112   actualvalues[UBound] = actual;
113   expectedvalues[UBound] = expect;
114   UBound++;
118 function test()
120   printBugNumber(BUGNUMBER);
121   printStatus(summary);
123   for (var i=0; i<UBound; i++)
124   {
125     reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
126   }