OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 // Test for the evaluation order of getters and setters. | 5 // Test for the evaluation order of getters and setters. |
6 | 6 |
| 7 import 'package:expect/expect.dart'; |
| 8 |
7 var trace; | 9 var trace; |
8 | 10 |
9 class X { | 11 class X { |
10 get b { | 12 get b { |
11 trace.add('get b'); | 13 trace.add('get b'); |
12 return new X(); | 14 return new X(); |
13 } | 15 } |
14 | 16 |
15 set c (value) { | 17 set c (value) { |
16 trace.add('set c'); | 18 trace.add('set c'); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 85 |
84 trace = []; | 86 trace = []; |
85 x.b.c = x.d[42] *= '$x'.hashCode; | 87 x.b.c = x.d[42] *= '$x'.hashCode; |
86 Expect.listEquals( | 88 Expect.listEquals( |
87 ['get b', 'get d', 'index', 'toString', 'indexSet', 'set c'], trace); | 89 ['get b', 'get d', 'index', 'toString', 'indexSet', 'set c'], trace); |
88 | 90 |
89 trace = []; | 91 trace = []; |
90 x.b.c = ++x.d.c; | 92 x.b.c = ++x.d.c; |
91 Expect.listEquals(['get b', 'get d', 'get c', 'set c', 'set c'], trace); | 93 Expect.listEquals(['get b', 'get d', 'get c', 'set c', 'set c'], trace); |
92 } | 94 } |
OLD | NEW |