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

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

Issue 3001803002: Migrate block 114 (and some of 113). (Closed)
Patch Set: Tweak app_jit status. Created 3 years, 4 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) 2011, 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 that a getter is evaluated after the arguments, when a getter is
6 // for invoking a method. See chapter 'Method Invocation' in specification.
7
8 import "package:expect/expect.dart";
9
10 var counter = 0;
11
12 class Test1 {
13 get a {
14 Expect.equals(1, counter);
15 counter++;
16 return (c) {};
17 }
18
19 b() {
20 Expect.equals(0, counter);
21 counter++;
22 return 1;
23 }
24 }
25
26 class Test2 {
27 static get a {
28 Expect.equals(0, counter);
29 counter++;
30 return (c) {};
31 }
32
33 static b() {
34 Expect.equals(1, counter);
35 counter++;
36 return 1;
37 }
38 }
39
40 get a {
41 Expect.equals(0, counter);
42 counter++;
43 return (c) {};
44 }
45
46 b() {
47 Expect.equals(1, counter);
48 counter++;
49 return 1;
50 }
51
52 main() {
53 var failures = [];
54 try {
55 // Check instance getters.
56 counter = 0;
57 var o = new Test1();
58 o.a(o.b());
59 Expect.equals(2, counter);
60 } catch (exc, stack) {
61 failures.add(exc);
62 failures.add(stack);
63 }
64 try {
65 // Check static getters.
66 counter = 0;
67 Test2.a(Test2.b());
68 Expect.equals(2, counter);
69 } catch (exc, stack) {
70 failures.add(exc);
71 failures.add(stack);
72 }
73 try {
74 // Check top-level getters.
75 counter = 0;
76 a(b());
77 Expect.equals(2, counter);
78 } catch (exc, stack) {
79 failures.add(exc);
80 failures.add(stack);
81 }
82 // If any of the tests failed print out the details and fail the test.
83 if (failures.length != 0) {
84 for (var msg in failures) {
85 print(msg.toString());
86 }
87 throw "${failures.length ~/ 2} tests failed.";
88 }
89 }
OLDNEW
« no previous file with comments | « tests/language_strong/get_set_syntax_test.dart ('k') | tests/language_strong/language_strong.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698