|
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 var BUGNUMBER = 321757; |
|
8 var summary = 'Compound assignment operators should not bind LHS'; |
|
9 var actual = ''; |
|
10 var expect = 'pass'; |
|
11 |
|
12 printBugNumber(BUGNUMBER); |
|
13 printStatus (summary); |
|
14 |
|
15 try |
|
16 { |
|
17 foo += 1; |
|
18 actual = "fail"; |
|
19 } |
|
20 catch (e) |
|
21 { |
|
22 actual = "pass"; |
|
23 } |
|
24 |
|
25 reportCompare(expect, actual, summary + ': +='); |
|
26 |
|
27 try |
|
28 { |
|
29 foo -= 1; |
|
30 actual = "fail"; |
|
31 } |
|
32 catch (e) |
|
33 { |
|
34 actual = "pass"; |
|
35 } |
|
36 |
|
37 reportCompare(expect, actual, summary + ': -='); |
|
38 |
|
39 try |
|
40 { |
|
41 foo *= 1; |
|
42 actual = "fail"; |
|
43 } |
|
44 catch (e) |
|
45 { |
|
46 actual = "pass"; |
|
47 } |
|
48 |
|
49 reportCompare(expect, actual, summary + ': *='); |
|
50 |
|
51 try |
|
52 { |
|
53 foo /= 1; |
|
54 actual = "fail"; |
|
55 } |
|
56 catch (e) |
|
57 { |
|
58 actual = "pass"; |
|
59 } |
|
60 |
|
61 reportCompare(expect, actual, summary + ': /='); |
|
62 |
|
63 try |
|
64 { |
|
65 foo %= 1; |
|
66 actual = "fail"; |
|
67 } |
|
68 catch (e) |
|
69 { |
|
70 actual = "pass"; |
|
71 } |
|
72 |
|
73 reportCompare(expect, actual, summary + ': %='); |
|
74 |
|
75 try |
|
76 { |
|
77 foo <<= 1; |
|
78 actual = "fail"; |
|
79 } |
|
80 catch (e) |
|
81 { |
|
82 actual = "pass"; |
|
83 } |
|
84 |
|
85 reportCompare(expect, actual, summary + ': <<='); |
|
86 |
|
87 try |
|
88 { |
|
89 foo >>= 1; |
|
90 actual = "fail"; |
|
91 } |
|
92 catch (e) |
|
93 { |
|
94 actual = "pass"; |
|
95 } |
|
96 |
|
97 reportCompare(expect, actual, summary + ': >>='); |
|
98 |
|
99 try |
|
100 { |
|
101 foo >>>= 1; |
|
102 actual = "fail"; |
|
103 } |
|
104 catch (e) |
|
105 { |
|
106 actual = "pass"; |
|
107 } |
|
108 |
|
109 reportCompare(expect, actual, summary + ': >>>='); |