Debian Codegraph @

rhino/testsrc/tests/js1_5/Regress/regress-203841.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 *
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 gTestfile = 'regress-203841.js';
16 var UBound = 0;
17 var BUGNUMBER = 203841;
18 var summary = 'Testing merged if-clauses';
19 var status = '';
20 var statusitems = [];
21 var actual = '';
22 var actualvalues = [];
23 var expect= '';
24 var expectedvalues = [];
25
26
27 status = inSection(1);
28 var a = 0;
29 var b = 0;
30 var c = 0;
31 if (a == 5, b == 6) { c = 1; }
32 actual = c;
33 expect = 0;
34 addThis();
35
36 status = inSection(2);
37 a = 5;
38 b = 0;
39 c = 0;
40 if (a == 5, b == 6) { c = 1; }
41 actual = c;
42 expect = 0;
43 addThis();
44
45 status = inSection(3);
46 a = 5;
47 b = 6;
48 c = 0;
49 if (a == 5, b == 6) { c = 1; }
50 actual = c;
51 expect = 1;
52 addThis();
53
54 /*
55 * Now get tricky and use the = operator inside the if-clause
56 */
57 status = inSection(4);
58 a = 0;
59 b = 6;
60 c = 0;
61 if (a = 5, b == 6) { c = 1; }
62 actual = c;
63 expect = 1;
64 addThis();
65
66 status = inSection(5);
67 c = 0;
68 if (1, 1 == 6) { c = 1; }
69 actual = c;
70 expect = 0;
71 addThis();
72
73
74 /*
75 * Now some tests involving arrays
76 */
77 var x=[];
78
79 status = inSection(6); // get element case
80 c = 0;
81 if (x[1==2]) { c = 1; }
82 actual = c;
83 expect = 0;
84 addThis();
85
86 status = inSection(7); // set element case
87 c = 0;
88 if (x[1==2]=1) { c = 1; }
89 actual = c;
90 expect = 1;
91 addThis();
92
93 status = inSection(8); // delete element case
94 c = 0;
95 if (delete x[1==2]) { c = 1; }
96 actual = c;
97 expect = 1;
98 addThis();
99
100
101
102
103 //-----------------------------------------------------------------------------
104 test();
105 //-----------------------------------------------------------------------------
106
107
108
109
110 function addThis()
111 {
112 statusitems[UBound] = status;
113 actualvalues[UBound] = actual;
114 expectedvalues[UBound] = expect;
115 UBound++;
116 }
117
118
119 function test()
120 {
121 enterFunc('test');
122 printBugNumber(BUGNUMBER);
123 printStatus(summary);
124
125 for (var i=0; i<UBound; i++)
126 {
127 reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
128 }
129
130 exitFunc ('test');
131 }