| Index: tests/language/compound_assignment_operator_test.dart
|
| ===================================================================
|
| --- tests/language/compound_assignment_operator_test.dart (revision 7165)
|
| +++ tests/language/compound_assignment_operator_test.dart (working copy)
|
| @@ -17,6 +17,14 @@
|
| var _f;
|
| }
|
|
|
| +var result;
|
| +
|
| +class A {
|
| + get field() { result.add(1); return 1; }
|
| + set field(value) {}
|
| +}
|
| +
|
| +
|
| class CompoundAssignmentOperatorTest {
|
|
|
| static void testIndexed() {
|
| @@ -37,11 +45,37 @@
|
| indexed[3][i++] += 1;
|
| Expect.equals(1, i);
|
| }
|
| +
|
| +
|
| + static testIndexedMore() {
|
| + result = [];
|
| + array() { result.add(0); return [0]; }
|
| + index() { result.add(1); return 0; }
|
| + middle() { result.add(2); }
|
| + sequence(a, b, c) { result.add(3); }
|
|
|
| + sequence(array()[index()] += 1, middle(), array()[index()] += 1);
|
| + Expect.listEquals([0, 1, 2, 0, 1, 3], result);
|
| + }
|
| +
|
| + static testIndexedMoreMore() {
|
| + result = [];
|
| + middle() { result.add(2); }
|
| + obj() { result.add(0); return new A(); }
|
| + sequence(a, b, c) { result.add(3); }
|
| +
|
| + sequence(obj().field += 1, middle(), obj().field += 1);
|
| + Expect.listEquals([0, 1, 2, 0, 1, 3], result);
|
| + }
|
| +
|
| +
|
| static void testMain() {
|
| testIndexed();
|
| + testIndexedMore();
|
| + testIndexedMoreMore();
|
| }
|
| }
|
| +
|
| main() {
|
| CompoundAssignmentOperatorTest.testMain();
|
| }
|
|
|