Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1093)

Side by Side Diff: tests/language_strong/getter_setter_order_test.dart

Issue 3005643002: Migrate block 115. (Closed)
Patch Set: Tweak status files. Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 // Test for the evaluation order of getters and setters.
6
7 import 'package:expect/expect.dart';
8
9 var trace;
10
11 class X {
12 get b {
13 trace.add('get b');
14 return new X();
15 }
16
17 set c(value) {
18 trace.add('set c');
19 }
20
21 toString() {
22 trace.add('toString');
23 return 'X';
24 }
25
26 get c {
27 trace.add('get c');
28 return 42;
29 }
30
31 get d {
32 trace.add('get d');
33 return new X();
34 }
35
36 operator [](index) {
37 trace.add('index');
38 return 42;
39 }
40
41 operator []=(index, value) {
42 trace.add('indexSet');
43 }
44 }
45
46 main() {
47 var x = new X();
48
49 trace = [];
50 x.b.c = '$x';
51 Expect.listEquals(['get b', 'toString', 'set c'], trace);
52
53 trace = [];
54 x.b.c += '$x'.hashCode;
55 Expect.listEquals(['get b', 'get c', 'toString', 'set c'], trace);
56
57 trace = [];
58 x.b.c++;
59 Expect.listEquals(['get b', 'get c', 'set c'], trace);
60
61 trace = [];
62 x.b.d[42] = '$x';
63 Expect.listEquals(['get b', 'get d', 'toString', 'indexSet'], trace);
64
65 trace = [];
66 x.b.d[42] += '$x'.hashCode;
67 Expect.listEquals(['get b', 'get d', 'index', 'toString', 'indexSet'], trace);
68
69 trace = [];
70 x.b.d[42]++;
71 Expect.listEquals(['get b', 'get d', 'index', 'indexSet'], trace);
72
73 trace = [];
74 ++x.b.d[42];
75 Expect.listEquals(['get b', 'get d', 'index', 'indexSet'], trace);
76
77 trace = [];
78 x.b.d[x.c] *= '$x'.hashCode;
79 Expect.listEquals(
80 ['get b', 'get d', 'get c', 'index', 'toString', 'indexSet'], trace);
81
82 trace = [];
83 x.b.c = x.d.c = '$x';
84 Expect.listEquals([
85 'get b',
86 'get d',
87 'toString',
88 'set c',
89 'set c',
90 ], trace);
91
92 trace = [];
93 x.b.c = x.d[42] *= '$x'.hashCode;
94 Expect.listEquals(
95 ['get b', 'get d', 'index', 'toString', 'indexSet', 'set c'], trace);
96
97 trace = [];
98 x.b.c = ++x.d.c;
99 Expect.listEquals(['get b', 'get d', 'get c', 'set c', 'set c'], trace);
100 }
OLDNEW
« no previous file with comments | « tests/language_strong/getter_setter_interceptor_test.dart ('k') | tests/language_strong/getters_setters2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698