1# Copyright 2013 the V8 project authors. All rights reserved.
2# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions
6# are met:
7# 1.  Redistributions of source code must retain the above copyright
8#     notice, this list of conditions and the following disclaimer.
9# 2.  Redistributions in binary form must reproduce the above copyright
10#     notice, this list of conditions and the following disclaimer in the
11#     documentation and/or other materials provided with the distribution.
12#
13# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
14# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
17# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23
24This test checks that parentheses are preserved when significant, and not added where inappropriate. We need this test because the JavaScriptCore parser removes all parentheses and the serializer then adds them back.
25
26On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
27
28
29PASS compileAndSerialize('a * b * c') is 'a * b * c'
30PASS compileAndSerialize('(a * b) * c') is '(a * b) * c'
31PASS compileAndSerialize('a * (b * c)') is 'a * (b * c)'
32PASS compileAndSerialize('a * b + c') is 'a * b + c'
33PASS compileAndSerialize('(a * b) + c') is '(a * b) + c'
34PASS compileAndSerialize('a * (b + c)') is 'a * (b + c)'
35PASS compileAndSerialize('a * b - c') is 'a * b - c'
36PASS compileAndSerialize('(a * b) - c') is '(a * b) - c'
37PASS compileAndSerialize('a * (b - c)') is 'a * (b - c)'
38PASS compileAndSerialize('a / b / c') is 'a / b / c'
39PASS compileAndSerialize('(a / b) / c') is '(a / b) / c'
40PASS compileAndSerialize('a / (b / c)') is 'a / (b / c)'
41PASS compileAndSerialize('a * b / c') is 'a * b / c'
42PASS compileAndSerialize('(a * b) / c') is '(a * b) / c'
43PASS compileAndSerialize('a * (b / c)') is 'a * (b / c)'
44PASS compileAndSerialize('a / b + c') is 'a / b + c'
45PASS compileAndSerialize('(a / b) + c') is '(a / b) + c'
46PASS compileAndSerialize('a / (b + c)') is 'a / (b + c)'
47PASS compileAndSerialize('a % b % c') is 'a % b % c'
48PASS compileAndSerialize('(a % b) % c') is '(a % b) % c'
49PASS compileAndSerialize('a % (b % c)') is 'a % (b % c)'
50PASS compileAndSerialize('a * b % c') is 'a * b % c'
51PASS compileAndSerialize('(a * b) % c') is '(a * b) % c'
52PASS compileAndSerialize('a * (b % c)') is 'a * (b % c)'
53PASS compileAndSerialize('a % b + c') is 'a % b + c'
54PASS compileAndSerialize('(a % b) + c') is '(a % b) + c'
55PASS compileAndSerialize('a % (b + c)') is 'a % (b + c)'
56PASS compileAndSerialize('a + b + c') is 'a + b + c'
57PASS compileAndSerialize('(a + b) + c') is '(a + b) + c'
58PASS compileAndSerialize('a + (b + c)') is 'a + (b + c)'
59PASS compileAndSerialize('a + b << c') is 'a + b << c'
60PASS compileAndSerialize('(a + b) << c') is '(a + b) << c'
61PASS compileAndSerialize('a + (b << c)') is 'a + (b << c)'
62PASS compileAndSerialize('a + b >> c') is 'a + b >> c'
63PASS compileAndSerialize('(a + b) >> c') is '(a + b) >> c'
64PASS compileAndSerialize('a + (b >> c)') is 'a + (b >> c)'
65PASS compileAndSerialize('a + b >>> c') is 'a + b >>> c'
66PASS compileAndSerialize('(a + b) >>> c') is '(a + b) >>> c'
67PASS compileAndSerialize('a + (b >>> c)') is 'a + (b >>> c)'
68PASS compileAndSerialize('a - b - c') is 'a - b - c'
69PASS compileAndSerialize('(a - b) - c') is '(a - b) - c'
70PASS compileAndSerialize('a - (b - c)') is 'a - (b - c)'
71PASS compileAndSerialize('a + b - c') is 'a + b - c'
72PASS compileAndSerialize('(a + b) - c') is '(a + b) - c'
73PASS compileAndSerialize('a + (b - c)') is 'a + (b - c)'
74PASS compileAndSerialize('a - b << c') is 'a - b << c'
75PASS compileAndSerialize('(a - b) << c') is '(a - b) << c'
76PASS compileAndSerialize('a - (b << c)') is 'a - (b << c)'
77PASS compileAndSerialize('a << b << c') is 'a << b << c'
78PASS compileAndSerialize('(a << b) << c') is '(a << b) << c'
79PASS compileAndSerialize('a << (b << c)') is 'a << (b << c)'
80PASS compileAndSerialize('a << b < c') is 'a << b < c'
81PASS compileAndSerialize('(a << b) < c') is '(a << b) < c'
82PASS compileAndSerialize('a << (b < c)') is 'a << (b < c)'
83PASS compileAndSerialize('a << b > c') is 'a << b > c'
84PASS compileAndSerialize('(a << b) > c') is '(a << b) > c'
85PASS compileAndSerialize('a << (b > c)') is 'a << (b > c)'
86PASS compileAndSerialize('a << b <= c') is 'a << b <= c'
87PASS compileAndSerialize('(a << b) <= c') is '(a << b) <= c'
88PASS compileAndSerialize('a << (b <= c)') is 'a << (b <= c)'
89PASS compileAndSerialize('a << b >= c') is 'a << b >= c'
90PASS compileAndSerialize('(a << b) >= c') is '(a << b) >= c'
91PASS compileAndSerialize('a << (b >= c)') is 'a << (b >= c)'
92PASS compileAndSerialize('a << b instanceof c') is 'a << b instanceof c'
93PASS compileAndSerialize('(a << b) instanceof c') is '(a << b) instanceof c'
94PASS compileAndSerialize('a << (b instanceof c)') is 'a << (b instanceof c)'
95PASS compileAndSerialize('a << b in c') is 'a << b in c'
96PASS compileAndSerialize('(a << b) in c') is '(a << b) in c'
97PASS compileAndSerialize('a << (b in c)') is 'a << (b in c)'
98PASS compileAndSerialize('a >> b >> c') is 'a >> b >> c'
99PASS compileAndSerialize('(a >> b) >> c') is '(a >> b) >> c'
100PASS compileAndSerialize('a >> (b >> c)') is 'a >> (b >> c)'
101PASS compileAndSerialize('a << b >> c') is 'a << b >> c'
102PASS compileAndSerialize('(a << b) >> c') is '(a << b) >> c'
103PASS compileAndSerialize('a << (b >> c)') is 'a << (b >> c)'
104PASS compileAndSerialize('a >> b < c') is 'a >> b < c'
105PASS compileAndSerialize('(a >> b) < c') is '(a >> b) < c'
106PASS compileAndSerialize('a >> (b < c)') is 'a >> (b < c)'
107PASS compileAndSerialize('a >>> b >>> c') is 'a >>> b >>> c'
108PASS compileAndSerialize('(a >>> b) >>> c') is '(a >>> b) >>> c'
109PASS compileAndSerialize('a >>> (b >>> c)') is 'a >>> (b >>> c)'
110PASS compileAndSerialize('a << b >>> c') is 'a << b >>> c'
111PASS compileAndSerialize('(a << b) >>> c') is '(a << b) >>> c'
112PASS compileAndSerialize('a << (b >>> c)') is 'a << (b >>> c)'
113PASS compileAndSerialize('a >>> b < c') is 'a >>> b < c'
114PASS compileAndSerialize('(a >>> b) < c') is '(a >>> b) < c'
115PASS compileAndSerialize('a >>> (b < c)') is 'a >>> (b < c)'
116PASS compileAndSerialize('a < b < c') is 'a < b < c'
117PASS compileAndSerialize('(a < b) < c') is '(a < b) < c'
118PASS compileAndSerialize('a < (b < c)') is 'a < (b < c)'
119PASS compileAndSerialize('a < b == c') is 'a < b == c'
120PASS compileAndSerialize('(a < b) == c') is '(a < b) == c'
121PASS compileAndSerialize('a < (b == c)') is 'a < (b == c)'
122PASS compileAndSerialize('a < b != c') is 'a < b != c'
123PASS compileAndSerialize('(a < b) != c') is '(a < b) != c'
124PASS compileAndSerialize('a < (b != c)') is 'a < (b != c)'
125PASS compileAndSerialize('a < b === c') is 'a < b === c'
126PASS compileAndSerialize('(a < b) === c') is '(a < b) === c'
127PASS compileAndSerialize('a < (b === c)') is 'a < (b === c)'
128PASS compileAndSerialize('a < b !== c') is 'a < b !== c'
129PASS compileAndSerialize('(a < b) !== c') is '(a < b) !== c'
130PASS compileAndSerialize('a < (b !== c)') is 'a < (b !== c)'
131PASS compileAndSerialize('a > b > c') is 'a > b > c'
132PASS compileAndSerialize('(a > b) > c') is '(a > b) > c'
133PASS compileAndSerialize('a > (b > c)') is 'a > (b > c)'
134PASS compileAndSerialize('a < b > c') is 'a < b > c'
135PASS compileAndSerialize('(a < b) > c') is '(a < b) > c'
136PASS compileAndSerialize('a < (b > c)') is 'a < (b > c)'
137PASS compileAndSerialize('a > b == c') is 'a > b == c'
138PASS compileAndSerialize('(a > b) == c') is '(a > b) == c'
139PASS compileAndSerialize('a > (b == c)') is 'a > (b == c)'
140PASS compileAndSerialize('a <= b <= c') is 'a <= b <= c'
141PASS compileAndSerialize('(a <= b) <= c') is '(a <= b) <= c'
142PASS compileAndSerialize('a <= (b <= c)') is 'a <= (b <= c)'
143PASS compileAndSerialize('a < b <= c') is 'a < b <= c'
144PASS compileAndSerialize('(a < b) <= c') is '(a < b) <= c'
145PASS compileAndSerialize('a < (b <= c)') is 'a < (b <= c)'
146PASS compileAndSerialize('a <= b == c') is 'a <= b == c'
147PASS compileAndSerialize('(a <= b) == c') is '(a <= b) == c'
148PASS compileAndSerialize('a <= (b == c)') is 'a <= (b == c)'
149PASS compileAndSerialize('a >= b >= c') is 'a >= b >= c'
150PASS compileAndSerialize('(a >= b) >= c') is '(a >= b) >= c'
151PASS compileAndSerialize('a >= (b >= c)') is 'a >= (b >= c)'
152PASS compileAndSerialize('a < b >= c') is 'a < b >= c'
153PASS compileAndSerialize('(a < b) >= c') is '(a < b) >= c'
154PASS compileAndSerialize('a < (b >= c)') is 'a < (b >= c)'
155PASS compileAndSerialize('a >= b == c') is 'a >= b == c'
156PASS compileAndSerialize('(a >= b) == c') is '(a >= b) == c'
157PASS compileAndSerialize('a >= (b == c)') is 'a >= (b == c)'
158PASS compileAndSerialize('a instanceof b instanceof c') is 'a instanceof b instanceof c'
159PASS compileAndSerialize('(a instanceof b) instanceof c') is '(a instanceof b) instanceof c'
160PASS compileAndSerialize('a instanceof (b instanceof c)') is 'a instanceof (b instanceof c)'
161PASS compileAndSerialize('a < b instanceof c') is 'a < b instanceof c'
162PASS compileAndSerialize('(a < b) instanceof c') is '(a < b) instanceof c'
163PASS compileAndSerialize('a < (b instanceof c)') is 'a < (b instanceof c)'
164PASS compileAndSerialize('a instanceof b == c') is 'a instanceof b == c'
165PASS compileAndSerialize('(a instanceof b) == c') is '(a instanceof b) == c'
166PASS compileAndSerialize('a instanceof (b == c)') is 'a instanceof (b == c)'
167PASS compileAndSerialize('a in b in c') is 'a in b in c'
168PASS compileAndSerialize('(a in b) in c') is '(a in b) in c'
169PASS compileAndSerialize('a in (b in c)') is 'a in (b in c)'
170PASS compileAndSerialize('a < b in c') is 'a < b in c'
171PASS compileAndSerialize('(a < b) in c') is '(a < b) in c'
172PASS compileAndSerialize('a < (b in c)') is 'a < (b in c)'
173PASS compileAndSerialize('a in b == c') is 'a in b == c'
174PASS compileAndSerialize('(a in b) == c') is '(a in b) == c'
175PASS compileAndSerialize('a in (b == c)') is 'a in (b == c)'
176PASS compileAndSerialize('a == b == c') is 'a == b == c'
177PASS compileAndSerialize('(a == b) == c') is '(a == b) == c'
178PASS compileAndSerialize('a == (b == c)') is 'a == (b == c)'
179PASS compileAndSerialize('a == b & c') is 'a == b & c'
180PASS compileAndSerialize('(a == b) & c') is '(a == b) & c'
181PASS compileAndSerialize('a == (b & c)') is 'a == (b & c)'
182PASS compileAndSerialize('a != b != c') is 'a != b != c'
183PASS compileAndSerialize('(a != b) != c') is '(a != b) != c'
184PASS compileAndSerialize('a != (b != c)') is 'a != (b != c)'
185PASS compileAndSerialize('a == b != c') is 'a == b != c'
186PASS compileAndSerialize('(a == b) != c') is '(a == b) != c'
187PASS compileAndSerialize('a == (b != c)') is 'a == (b != c)'
188PASS compileAndSerialize('a != b & c') is 'a != b & c'
189PASS compileAndSerialize('(a != b) & c') is '(a != b) & c'
190PASS compileAndSerialize('a != (b & c)') is 'a != (b & c)'
191PASS compileAndSerialize('a === b === c') is 'a === b === c'
192PASS compileAndSerialize('(a === b) === c') is '(a === b) === c'
193PASS compileAndSerialize('a === (b === c)') is 'a === (b === c)'
194PASS compileAndSerialize('a == b === c') is 'a == b === c'
195PASS compileAndSerialize('(a == b) === c') is '(a == b) === c'
196PASS compileAndSerialize('a == (b === c)') is 'a == (b === c)'
197PASS compileAndSerialize('a === b & c') is 'a === b & c'
198PASS compileAndSerialize('(a === b) & c') is '(a === b) & c'
199PASS compileAndSerialize('a === (b & c)') is 'a === (b & c)'
200PASS compileAndSerialize('a !== b !== c') is 'a !== b !== c'
201PASS compileAndSerialize('(a !== b) !== c') is '(a !== b) !== c'
202PASS compileAndSerialize('a !== (b !== c)') is 'a !== (b !== c)'
203PASS compileAndSerialize('a == b !== c') is 'a == b !== c'
204PASS compileAndSerialize('(a == b) !== c') is '(a == b) !== c'
205PASS compileAndSerialize('a == (b !== c)') is 'a == (b !== c)'
206PASS compileAndSerialize('a !== b & c') is 'a !== b & c'
207PASS compileAndSerialize('(a !== b) & c') is '(a !== b) & c'
208PASS compileAndSerialize('a !== (b & c)') is 'a !== (b & c)'
209PASS compileAndSerialize('a & b & c') is 'a & b & c'
210PASS compileAndSerialize('(a & b) & c') is '(a & b) & c'
211PASS compileAndSerialize('a & (b & c)') is 'a & (b & c)'
212PASS compileAndSerialize('a & b ^ c') is 'a & b ^ c'
213PASS compileAndSerialize('(a & b) ^ c') is '(a & b) ^ c'
214PASS compileAndSerialize('a & (b ^ c)') is 'a & (b ^ c)'
215PASS compileAndSerialize('a ^ b ^ c') is 'a ^ b ^ c'
216PASS compileAndSerialize('(a ^ b) ^ c') is '(a ^ b) ^ c'
217PASS compileAndSerialize('a ^ (b ^ c)') is 'a ^ (b ^ c)'
218PASS compileAndSerialize('a ^ b | c') is 'a ^ b | c'
219PASS compileAndSerialize('(a ^ b) | c') is '(a ^ b) | c'
220PASS compileAndSerialize('a ^ (b | c)') is 'a ^ (b | c)'
221PASS compileAndSerialize('a | b | c') is 'a | b | c'
222PASS compileAndSerialize('(a | b) | c') is '(a | b) | c'
223PASS compileAndSerialize('a | (b | c)') is 'a | (b | c)'
224PASS compileAndSerialize('a | b && c') is 'a | b && c'
225PASS compileAndSerialize('(a | b) && c') is '(a | b) && c'
226PASS compileAndSerialize('a | (b && c)') is 'a | (b && c)'
227PASS compileAndSerialize('a && b && c') is 'a && b && c'
228PASS compileAndSerialize('(a && b) && c') is '(a && b) && c'
229PASS compileAndSerialize('a && (b && c)') is 'a && (b && c)'
230PASS compileAndSerialize('a && b || c') is 'a && b || c'
231PASS compileAndSerialize('(a && b) || c') is '(a && b) || c'
232PASS compileAndSerialize('a && (b || c)') is 'a && (b || c)'
233PASS compileAndSerialize('a || b || c') is 'a || b || c'
234PASS compileAndSerialize('(a || b) || c') is '(a || b) || c'
235PASS compileAndSerialize('a || (b || c)') is 'a || (b || c)'
236PASS compileAndSerialize('a = b = c') is 'a = b = c'
237FAIL compileAndSerialize('(a = b) = c') should be (a = b) = c. Threw exception ReferenceError: Invalid left-hand side in assignment
238PASS compileAndSerialize('a = (b = c)') is 'a = (b = c)'
239PASS compileAndSerialize('a = b + c') is 'a = b + c'
240PASS compileAndSerialize('(a = b) + c') is '(a = b) + c'
241PASS compileAndSerialize('a = (b + c)') is 'a = (b + c)'
242PASS compileAndSerialize('a + b = c') threw exception ReferenceError: Invalid left-hand side in assignment.
243FAIL compileAndSerialize('(a + b) = c') should be (a + b) = c. Threw exception ReferenceError: Invalid left-hand side in assignment
244PASS compileAndSerialize('a + (b = c)') is 'a + (b = c)'
245PASS compileAndSerialize('a *= b *= c') is 'a *= b *= c'
246FAIL compileAndSerialize('(a *= b) *= c') should be (a *= b) *= c. Threw exception ReferenceError: Invalid left-hand side in assignment
247PASS compileAndSerialize('a *= (b *= c)') is 'a *= (b *= c)'
248PASS compileAndSerialize('a = b *= c') is 'a = b *= c'
249FAIL compileAndSerialize('(a = b) *= c') should be (a = b) *= c. Threw exception ReferenceError: Invalid left-hand side in assignment
250PASS compileAndSerialize('a = (b *= c)') is 'a = (b *= c)'
251PASS compileAndSerialize('a *= b + c') is 'a *= b + c'
252PASS compileAndSerialize('(a *= b) + c') is '(a *= b) + c'
253PASS compileAndSerialize('a *= (b + c)') is 'a *= (b + c)'
254PASS compileAndSerialize('a + b *= c') threw exception ReferenceError: Invalid left-hand side in assignment.
255FAIL compileAndSerialize('(a + b) *= c') should be (a + b) *= c. Threw exception ReferenceError: Invalid left-hand side in assignment
256PASS compileAndSerialize('a + (b *= c)') is 'a + (b *= c)'
257PASS compileAndSerialize('a /= b /= c') is 'a /= b /= c'
258FAIL compileAndSerialize('(a /= b) /= c') should be (a /= b) /= c. Threw exception ReferenceError: Invalid left-hand side in assignment
259PASS compileAndSerialize('a /= (b /= c)') is 'a /= (b /= c)'
260PASS compileAndSerialize('a = b /= c') is 'a = b /= c'
261FAIL compileAndSerialize('(a = b) /= c') should be (a = b) /= c. Threw exception ReferenceError: Invalid left-hand side in assignment
262PASS compileAndSerialize('a = (b /= c)') is 'a = (b /= c)'
263PASS compileAndSerialize('a /= b + c') is 'a /= b + c'
264PASS compileAndSerialize('(a /= b) + c') is '(a /= b) + c'
265PASS compileAndSerialize('a /= (b + c)') is 'a /= (b + c)'
266PASS compileAndSerialize('a + b /= c') threw exception ReferenceError: Invalid left-hand side in assignment.
267FAIL compileAndSerialize('(a + b) /= c') should be (a + b) /= c. Threw exception ReferenceError: Invalid left-hand side in assignment
268PASS compileAndSerialize('a + (b /= c)') is 'a + (b /= c)'
269PASS compileAndSerialize('a %= b %= c') is 'a %= b %= c'
270FAIL compileAndSerialize('(a %= b) %= c') should be (a %= b) %= c. Threw exception ReferenceError: Invalid left-hand side in assignment
271PASS compileAndSerialize('a %= (b %= c)') is 'a %= (b %= c)'
272PASS compileAndSerialize('a = b %= c') is 'a = b %= c'
273FAIL compileAndSerialize('(a = b) %= c') should be (a = b) %= c. Threw exception ReferenceError: Invalid left-hand side in assignment
274PASS compileAndSerialize('a = (b %= c)') is 'a = (b %= c)'
275PASS compileAndSerialize('a %= b + c') is 'a %= b + c'
276PASS compileAndSerialize('(a %= b) + c') is '(a %= b) + c'
277PASS compileAndSerialize('a %= (b + c)') is 'a %= (b + c)'
278PASS compileAndSerialize('a + b %= c') threw exception ReferenceError: Invalid left-hand side in assignment.
279FAIL compileAndSerialize('(a + b) %= c') should be (a + b) %= c. Threw exception ReferenceError: Invalid left-hand side in assignment
280PASS compileAndSerialize('a + (b %= c)') is 'a + (b %= c)'
281PASS compileAndSerialize('a += b += c') is 'a += b += c'
282FAIL compileAndSerialize('(a += b) += c') should be (a += b) += c. Threw exception ReferenceError: Invalid left-hand side in assignment
283PASS compileAndSerialize('a += (b += c)') is 'a += (b += c)'
284PASS compileAndSerialize('a = b += c') is 'a = b += c'
285FAIL compileAndSerialize('(a = b) += c') should be (a = b) += c. Threw exception ReferenceError: Invalid left-hand side in assignment
286PASS compileAndSerialize('a = (b += c)') is 'a = (b += c)'
287PASS compileAndSerialize('a += b + c') is 'a += b + c'
288PASS compileAndSerialize('(a += b) + c') is '(a += b) + c'
289PASS compileAndSerialize('a += (b + c)') is 'a += (b + c)'
290PASS compileAndSerialize('a + b += c') threw exception ReferenceError: Invalid left-hand side in assignment.
291FAIL compileAndSerialize('(a + b) += c') should be (a + b) += c. Threw exception ReferenceError: Invalid left-hand side in assignment
292PASS compileAndSerialize('a + (b += c)') is 'a + (b += c)'
293PASS compileAndSerialize('a -= b -= c') is 'a -= b -= c'
294FAIL compileAndSerialize('(a -= b) -= c') should be (a -= b) -= c. Threw exception ReferenceError: Invalid left-hand side in assignment
295PASS compileAndSerialize('a -= (b -= c)') is 'a -= (b -= c)'
296PASS compileAndSerialize('a = b -= c') is 'a = b -= c'
297FAIL compileAndSerialize('(a = b) -= c') should be (a = b) -= c. Threw exception ReferenceError: Invalid left-hand side in assignment
298PASS compileAndSerialize('a = (b -= c)') is 'a = (b -= c)'
299PASS compileAndSerialize('a -= b + c') is 'a -= b + c'
300PASS compileAndSerialize('(a -= b) + c') is '(a -= b) + c'
301PASS compileAndSerialize('a -= (b + c)') is 'a -= (b + c)'
302PASS compileAndSerialize('a + b -= c') threw exception ReferenceError: Invalid left-hand side in assignment.
303FAIL compileAndSerialize('(a + b) -= c') should be (a + b) -= c. Threw exception ReferenceError: Invalid left-hand side in assignment
304PASS compileAndSerialize('a + (b -= c)') is 'a + (b -= c)'
305PASS compileAndSerialize('a <<= b <<= c') is 'a <<= b <<= c'
306FAIL compileAndSerialize('(a <<= b) <<= c') should be (a <<= b) <<= c. Threw exception ReferenceError: Invalid left-hand side in assignment
307PASS compileAndSerialize('a <<= (b <<= c)') is 'a <<= (b <<= c)'
308PASS compileAndSerialize('a = b <<= c') is 'a = b <<= c'
309FAIL compileAndSerialize('(a = b) <<= c') should be (a = b) <<= c. Threw exception ReferenceError: Invalid left-hand side in assignment
310PASS compileAndSerialize('a = (b <<= c)') is 'a = (b <<= c)'
311PASS compileAndSerialize('a <<= b + c') is 'a <<= b + c'
312PASS compileAndSerialize('(a <<= b) + c') is '(a <<= b) + c'
313PASS compileAndSerialize('a <<= (b + c)') is 'a <<= (b + c)'
314PASS compileAndSerialize('a + b <<= c') threw exception ReferenceError: Invalid left-hand side in assignment.
315FAIL compileAndSerialize('(a + b) <<= c') should be (a + b) <<= c. Threw exception ReferenceError: Invalid left-hand side in assignment
316PASS compileAndSerialize('a + (b <<= c)') is 'a + (b <<= c)'
317PASS compileAndSerialize('a >>= b >>= c') is 'a >>= b >>= c'
318FAIL compileAndSerialize('(a >>= b) >>= c') should be (a >>= b) >>= c. Threw exception ReferenceError: Invalid left-hand side in assignment
319PASS compileAndSerialize('a >>= (b >>= c)') is 'a >>= (b >>= c)'
320PASS compileAndSerialize('a = b >>= c') is 'a = b >>= c'
321FAIL compileAndSerialize('(a = b) >>= c') should be (a = b) >>= c. Threw exception ReferenceError: Invalid left-hand side in assignment
322PASS compileAndSerialize('a = (b >>= c)') is 'a = (b >>= c)'
323PASS compileAndSerialize('a >>= b + c') is 'a >>= b + c'
324PASS compileAndSerialize('(a >>= b) + c') is '(a >>= b) + c'
325PASS compileAndSerialize('a >>= (b + c)') is 'a >>= (b + c)'
326PASS compileAndSerialize('a + b >>= c') threw exception ReferenceError: Invalid left-hand side in assignment.
327FAIL compileAndSerialize('(a + b) >>= c') should be (a + b) >>= c. Threw exception ReferenceError: Invalid left-hand side in assignment
328PASS compileAndSerialize('a + (b >>= c)') is 'a + (b >>= c)'
329PASS compileAndSerialize('a >>>= b >>>= c') is 'a >>>= b >>>= c'
330FAIL compileAndSerialize('(a >>>= b) >>>= c') should be (a >>>= b) >>>= c. Threw exception ReferenceError: Invalid left-hand side in assignment
331PASS compileAndSerialize('a >>>= (b >>>= c)') is 'a >>>= (b >>>= c)'
332PASS compileAndSerialize('a = b >>>= c') is 'a = b >>>= c'
333FAIL compileAndSerialize('(a = b) >>>= c') should be (a = b) >>>= c. Threw exception ReferenceError: Invalid left-hand side in assignment
334PASS compileAndSerialize('a = (b >>>= c)') is 'a = (b >>>= c)'
335PASS compileAndSerialize('a >>>= b + c') is 'a >>>= b + c'
336PASS compileAndSerialize('(a >>>= b) + c') is '(a >>>= b) + c'
337PASS compileAndSerialize('a >>>= (b + c)') is 'a >>>= (b + c)'
338PASS compileAndSerialize('a + b >>>= c') threw exception ReferenceError: Invalid left-hand side in assignment.
339FAIL compileAndSerialize('(a + b) >>>= c') should be (a + b) >>>= c. Threw exception ReferenceError: Invalid left-hand side in assignment
340PASS compileAndSerialize('a + (b >>>= c)') is 'a + (b >>>= c)'
341PASS compileAndSerialize('a &= b &= c') is 'a &= b &= c'
342FAIL compileAndSerialize('(a &= b) &= c') should be (a &= b) &= c. Threw exception ReferenceError: Invalid left-hand side in assignment
343PASS compileAndSerialize('a &= (b &= c)') is 'a &= (b &= c)'
344PASS compileAndSerialize('a = b &= c') is 'a = b &= c'
345FAIL compileAndSerialize('(a = b) &= c') should be (a = b) &= c. Threw exception ReferenceError: Invalid left-hand side in assignment
346PASS compileAndSerialize('a = (b &= c)') is 'a = (b &= c)'
347PASS compileAndSerialize('a &= b + c') is 'a &= b + c'
348PASS compileAndSerialize('(a &= b) + c') is '(a &= b) + c'
349PASS compileAndSerialize('a &= (b + c)') is 'a &= (b + c)'
350PASS compileAndSerialize('a + b &= c') threw exception ReferenceError: Invalid left-hand side in assignment.
351FAIL compileAndSerialize('(a + b) &= c') should be (a + b) &= c. Threw exception ReferenceError: Invalid left-hand side in assignment
352PASS compileAndSerialize('a + (b &= c)') is 'a + (b &= c)'
353PASS compileAndSerialize('a ^= b ^= c') is 'a ^= b ^= c'
354FAIL compileAndSerialize('(a ^= b) ^= c') should be (a ^= b) ^= c. Threw exception ReferenceError: Invalid left-hand side in assignment
355PASS compileAndSerialize('a ^= (b ^= c)') is 'a ^= (b ^= c)'
356PASS compileAndSerialize('a = b ^= c') is 'a = b ^= c'
357FAIL compileAndSerialize('(a = b) ^= c') should be (a = b) ^= c. Threw exception ReferenceError: Invalid left-hand side in assignment
358PASS compileAndSerialize('a = (b ^= c)') is 'a = (b ^= c)'
359PASS compileAndSerialize('a ^= b + c') is 'a ^= b + c'
360PASS compileAndSerialize('(a ^= b) + c') is '(a ^= b) + c'
361PASS compileAndSerialize('a ^= (b + c)') is 'a ^= (b + c)'
362PASS compileAndSerialize('a + b ^= c') threw exception ReferenceError: Invalid left-hand side in assignment.
363FAIL compileAndSerialize('(a + b) ^= c') should be (a + b) ^= c. Threw exception ReferenceError: Invalid left-hand side in assignment
364PASS compileAndSerialize('a + (b ^= c)') is 'a + (b ^= c)'
365PASS compileAndSerialize('a |= b |= c') is 'a |= b |= c'
366FAIL compileAndSerialize('(a |= b) |= c') should be (a |= b) |= c. Threw exception ReferenceError: Invalid left-hand side in assignment
367PASS compileAndSerialize('a |= (b |= c)') is 'a |= (b |= c)'
368PASS compileAndSerialize('a = b |= c') is 'a = b |= c'
369FAIL compileAndSerialize('(a = b) |= c') should be (a = b) |= c. Threw exception ReferenceError: Invalid left-hand side in assignment
370PASS compileAndSerialize('a = (b |= c)') is 'a = (b |= c)'
371PASS compileAndSerialize('a |= b + c') is 'a |= b + c'
372PASS compileAndSerialize('(a |= b) + c') is '(a |= b) + c'
373PASS compileAndSerialize('a |= (b + c)') is 'a |= (b + c)'
374PASS compileAndSerialize('a + b |= c') threw exception ReferenceError: Invalid left-hand side in assignment.
375FAIL compileAndSerialize('(a + b) |= c') should be (a + b) |= c. Threw exception ReferenceError: Invalid left-hand side in assignment
376PASS compileAndSerialize('a + (b |= c)') is 'a + (b |= c)'
377PASS compileAndSerialize('delete a + b') is 'delete a + b'
378PASS compileAndSerialize('(delete a) + b') is '(delete a) + b'
379PASS compileAndSerialize('delete (a + b)') is 'delete (a + b)'
380PASS compileAndSerialize('!delete a') is '!delete a'
381PASS compileAndSerialize('!(delete a)') is '!(delete a)'
382PASS compileAndSerialize('void a + b') is 'void a + b'
383PASS compileAndSerialize('(void a) + b') is '(void a) + b'
384PASS compileAndSerialize('void (a + b)') is 'void (a + b)'
385PASS compileAndSerialize('!void a') is '!void a'
386PASS compileAndSerialize('!(void a)') is '!(void a)'
387PASS compileAndSerialize('typeof a + b') is 'typeof a + b'
388PASS compileAndSerialize('(typeof a) + b') is '(typeof a) + b'
389PASS compileAndSerialize('typeof (a + b)') is 'typeof (a + b)'
390PASS compileAndSerialize('!typeof a') is '!typeof a'
391PASS compileAndSerialize('!(typeof a)') is '!(typeof a)'
392PASS compileAndSerialize('++a + b') is '++a + b'
393PASS compileAndSerialize('(++a) + b') is '(++a) + b'
394FAIL compileAndSerialize('++(a + b)') should be ++(a + b). Threw exception ReferenceError: Invalid left-hand side expression in prefix operation
395PASS compileAndSerialize('!++a') is '!++a'
396PASS compileAndSerialize('!(++a)') is '!(++a)'
397PASS compileAndSerialize('--a + b') is '--a + b'
398PASS compileAndSerialize('(--a) + b') is '(--a) + b'
399FAIL compileAndSerialize('--(a + b)') should be --(a + b). Threw exception ReferenceError: Invalid left-hand side expression in prefix operation
400PASS compileAndSerialize('!--a') is '!--a'
401PASS compileAndSerialize('!(--a)') is '!(--a)'
402PASS compileAndSerialize('+ a + b') is '+ a + b'
403PASS compileAndSerialize('(+ a) + b') is '(+ a) + b'
404PASS compileAndSerialize('+ (a + b)') is '+ (a + b)'
405PASS compileAndSerialize('!+ a') is '!+ a'
406PASS compileAndSerialize('!(+ a)') is '!(+ a)'
407PASS compileAndSerialize('- a + b') is '- a + b'
408PASS compileAndSerialize('(- a) + b') is '(- a) + b'
409PASS compileAndSerialize('- (a + b)') is '- (a + b)'
410PASS compileAndSerialize('!- a') is '!- a'
411PASS compileAndSerialize('!(- a)') is '!(- a)'
412PASS compileAndSerialize('~a + b') is '~a + b'
413PASS compileAndSerialize('(~a) + b') is '(~a) + b'
414PASS compileAndSerialize('~(a + b)') is '~(a + b)'
415PASS compileAndSerialize('!~a') is '!~a'
416PASS compileAndSerialize('!(~a)') is '!(~a)'
417PASS compileAndSerialize('!a + b') is '!a + b'
418PASS compileAndSerialize('(!a) + b') is '(!a) + b'
419PASS compileAndSerialize('!(a + b)') is '!(a + b)'
420PASS compileAndSerialize('!!a') is '!!a'
421PASS compileAndSerialize('!(!a)') is '!(!a)'
422PASS compileAndSerialize('!a++') is '!a++'
423PASS compileAndSerialize('!(a++)') is '!(a++)'
424FAIL compileAndSerialize('(!a)++') should be (!a)++. Threw exception ReferenceError: Invalid left-hand side expression in postfix operation
425PASS compileAndSerialize('!a--') is '!a--'
426PASS compileAndSerialize('!(a--)') is '!(a--)'
427FAIL compileAndSerialize('(!a)--') should be (!a)--. Threw exception ReferenceError: Invalid left-hand side expression in postfix operation
428PASS compileAndSerialize('(-1)[a]') is '(-1)[a]'
429PASS compileAndSerialize('(-1)[a] = b') is '(-1)[a] = b'
430PASS compileAndSerialize('(-1)[a] += b') is '(-1)[a] += b'
431PASS compileAndSerialize('(-1)[a]++') is '(-1)[a]++'
432PASS compileAndSerialize('++(-1)[a]') is '++(-1)[a]'
433PASS compileAndSerialize('(-1)[a]()') is '(-1)[a]()'
434PASS compileAndSerialize('new (-1)()') is 'new (-1)()'
435PASS compileAndSerialize('(-1).a') is '(-1).a'
436PASS compileAndSerialize('(-1).a = b') is '(-1).a = b'
437PASS compileAndSerialize('(-1).a += b') is '(-1).a += b'
438PASS compileAndSerialize('(-1).a++') is '(-1).a++'
439PASS compileAndSerialize('++(-1).a') is '++(-1).a'
440PASS compileAndSerialize('(-1).a()') is '(-1).a()'
441PASS compileAndSerialize('(- 0)[a]') is '(- 0)[a]'
442PASS compileAndSerialize('(- 0)[a] = b') is '(- 0)[a] = b'
443PASS compileAndSerialize('(- 0)[a] += b') is '(- 0)[a] += b'
444PASS compileAndSerialize('(- 0)[a]++') is '(- 0)[a]++'
445PASS compileAndSerialize('++(- 0)[a]') is '++(- 0)[a]'
446PASS compileAndSerialize('(- 0)[a]()') is '(- 0)[a]()'
447PASS compileAndSerialize('new (- 0)()') is 'new (- 0)()'
448PASS compileAndSerialize('(- 0).a') is '(- 0).a'
449PASS compileAndSerialize('(- 0).a = b') is '(- 0).a = b'
450PASS compileAndSerialize('(- 0).a += b') is '(- 0).a += b'
451PASS compileAndSerialize('(- 0).a++') is '(- 0).a++'
452PASS compileAndSerialize('++(- 0).a') is '++(- 0).a'
453PASS compileAndSerialize('(- 0).a()') is '(- 0).a()'
454PASS compileAndSerialize('(1)[a]') is '(1)[a]'
455PASS compileAndSerialize('(1)[a] = b') is '(1)[a] = b'
456PASS compileAndSerialize('(1)[a] += b') is '(1)[a] += b'
457PASS compileAndSerialize('(1)[a]++') is '(1)[a]++'
458PASS compileAndSerialize('++(1)[a]') is '++(1)[a]'
459PASS compileAndSerialize('(1)[a]()') is '(1)[a]()'
460PASS compileAndSerialize('new (1)()') is 'new (1)()'
461PASS compileAndSerialize('(1).a') is '(1).a'
462PASS compileAndSerialize('(1).a = b') is '(1).a = b'
463PASS compileAndSerialize('(1).a += b') is '(1).a += b'
464PASS compileAndSerialize('(1).a++') is '(1).a++'
465PASS compileAndSerialize('++(1).a') is '++(1).a'
466PASS compileAndSerialize('(1).a()') is '(1).a()'
467FAIL compileAndSerialize('(-1) = a') should be (-1) = a. Threw exception ReferenceError: Invalid left-hand side in assignment
468FAIL compileAndSerialize('(- 0) = a') should be (- 0) = a. Threw exception ReferenceError: Invalid left-hand side in assignment
469FAIL compileAndSerialize('1 = a') should be 1 = a. Threw exception ReferenceError: Invalid left-hand side in assignment
470FAIL compileAndSerialize('(-1) *= a') should be (-1) *= a. Threw exception ReferenceError: Invalid left-hand side in assignment
471FAIL compileAndSerialize('(- 0) *= a') should be (- 0) *= a. Threw exception ReferenceError: Invalid left-hand side in assignment
472FAIL compileAndSerialize('1 *= a') should be 1 *= a. Threw exception ReferenceError: Invalid left-hand side in assignment
473FAIL compileAndSerialize('(-1) /= a') should be (-1) /= a. Threw exception ReferenceError: Invalid left-hand side in assignment
474FAIL compileAndSerialize('(- 0) /= a') should be (- 0) /= a. Threw exception ReferenceError: Invalid left-hand side in assignment
475FAIL compileAndSerialize('1 /= a') should be 1 /= a. Threw exception ReferenceError: Invalid left-hand side in assignment
476FAIL compileAndSerialize('(-1) %= a') should be (-1) %= a. Threw exception ReferenceError: Invalid left-hand side in assignment
477FAIL compileAndSerialize('(- 0) %= a') should be (- 0) %= a. Threw exception ReferenceError: Invalid left-hand side in assignment
478FAIL compileAndSerialize('1 %= a') should be 1 %= a. Threw exception ReferenceError: Invalid left-hand side in assignment
479FAIL compileAndSerialize('(-1) += a') should be (-1) += a. Threw exception ReferenceError: Invalid left-hand side in assignment
480FAIL compileAndSerialize('(- 0) += a') should be (- 0) += a. Threw exception ReferenceError: Invalid left-hand side in assignment
481FAIL compileAndSerialize('1 += a') should be 1 += a. Threw exception ReferenceError: Invalid left-hand side in assignment
482FAIL compileAndSerialize('(-1) -= a') should be (-1) -= a. Threw exception ReferenceError: Invalid left-hand side in assignment
483FAIL compileAndSerialize('(- 0) -= a') should be (- 0) -= a. Threw exception ReferenceError: Invalid left-hand side in assignment
484FAIL compileAndSerialize('1 -= a') should be 1 -= a. Threw exception ReferenceError: Invalid left-hand side in assignment
485FAIL compileAndSerialize('(-1) <<= a') should be (-1) <<= a. Threw exception ReferenceError: Invalid left-hand side in assignment
486FAIL compileAndSerialize('(- 0) <<= a') should be (- 0) <<= a. Threw exception ReferenceError: Invalid left-hand side in assignment
487FAIL compileAndSerialize('1 <<= a') should be 1 <<= a. Threw exception ReferenceError: Invalid left-hand side in assignment
488FAIL compileAndSerialize('(-1) >>= a') should be (-1) >>= a. Threw exception ReferenceError: Invalid left-hand side in assignment
489FAIL compileAndSerialize('(- 0) >>= a') should be (- 0) >>= a. Threw exception ReferenceError: Invalid left-hand side in assignment
490FAIL compileAndSerialize('1 >>= a') should be 1 >>= a. Threw exception ReferenceError: Invalid left-hand side in assignment
491FAIL compileAndSerialize('(-1) >>>= a') should be (-1) >>>= a. Threw exception ReferenceError: Invalid left-hand side in assignment
492FAIL compileAndSerialize('(- 0) >>>= a') should be (- 0) >>>= a. Threw exception ReferenceError: Invalid left-hand side in assignment
493FAIL compileAndSerialize('1 >>>= a') should be 1 >>>= a. Threw exception ReferenceError: Invalid left-hand side in assignment
494FAIL compileAndSerialize('(-1) &= a') should be (-1) &= a. Threw exception ReferenceError: Invalid left-hand side in assignment
495FAIL compileAndSerialize('(- 0) &= a') should be (- 0) &= a. Threw exception ReferenceError: Invalid left-hand side in assignment
496FAIL compileAndSerialize('1 &= a') should be 1 &= a. Threw exception ReferenceError: Invalid left-hand side in assignment
497FAIL compileAndSerialize('(-1) ^= a') should be (-1) ^= a. Threw exception ReferenceError: Invalid left-hand side in assignment
498FAIL compileAndSerialize('(- 0) ^= a') should be (- 0) ^= a. Threw exception ReferenceError: Invalid left-hand side in assignment
499FAIL compileAndSerialize('1 ^= a') should be 1 ^= a. Threw exception ReferenceError: Invalid left-hand side in assignment
500FAIL compileAndSerialize('(-1) |= a') should be (-1) |= a. Threw exception ReferenceError: Invalid left-hand side in assignment
501FAIL compileAndSerialize('(- 0) |= a') should be (- 0) |= a. Threw exception ReferenceError: Invalid left-hand side in assignment
502FAIL compileAndSerialize('1 |= a') should be 1 |= a. Threw exception ReferenceError: Invalid left-hand side in assignment
503PASS compileAndSerializeLeftmostTest('({ }).x') is '({ }).x'
504PASS compileAndSerializeLeftmostTest('x = { }') is 'x = { }'
505PASS compileAndSerializeLeftmostTest('(function () { })()') is '(function () { })()'
506PASS compileAndSerializeLeftmostTest('x = function () { }') is 'x = function () { }'
507PASS compileAndSerializeLeftmostTest('var a') is 'var a'
508PASS compileAndSerializeLeftmostTest('var a = 1') is 'var a = 1'
509PASS compileAndSerializeLeftmostTest('var a, b') is 'var a, b'
510PASS compileAndSerializeLeftmostTest('var a = 1, b = 2') is 'var a = 1, b = 2'
511PASS compileAndSerializeLeftmostTest('var a, b, c') is 'var a, b, c'
512PASS compileAndSerializeLeftmostTest('var a = 1, b = 2, c = 3') is 'var a = 1, b = 2, c = 3'
513PASS compileAndSerializeLeftmostTest('const a = 1') is 'const a = 1'
514PASS compileAndSerializeLeftmostTest('const a = (1, 2)') is 'const a = (1, 2)'
515PASS compileAndSerializeLeftmostTest('const a, b = 1') is 'const a, b = 1'
516PASS compileAndSerializeLeftmostTest('const a = 1, b') is 'const a = 1, b'
517PASS compileAndSerializeLeftmostTest('const a = 1, b = 1') is 'const a = 1, b = 1'
518PASS compileAndSerializeLeftmostTest('const a = (1, 2), b = 1') is 'const a = (1, 2), b = 1'
519PASS compileAndSerializeLeftmostTest('const a = 1, b = (1, 2)') is 'const a = 1, b = (1, 2)'
520PASS compileAndSerializeLeftmostTest('const a = (1, 2), b = (1, 2)') is 'const a = (1, 2), b = (1, 2)'
521PASS compileAndSerialize('(function () { new (a.b()).c })') is '(function () { new (a.b()).c })'
522PASS successfullyParsed is true
523
524TEST COMPLETE
525
526