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

Side by Side Diff: tests/language/async_control_structures_test.dart

Issue 467323002: Fix call to completer for async closures. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: added iterations to test Created 6 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 // VMOptions=--enable_async 5 // VMOptions=--enable_async --optimization-counter-threshold=10
6 6
7 import 'package:expect/expect.dart'; 7 import 'package:expect/expect.dart';
8 8
9 import 'dart:async'; 9 import 'dart:async';
10 10
11 expectThenValue(future, value) { 11 expectThenValue(future, value) {
12 Expect.isTrue(future is Future); 12 Expect.isTrue(future is Future);
13 future.then((result) { 13 future.then((result) {
14 Expect.equals(value, result); 14 Expect.equals(value, result);
15 }); 15 });
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 62
63 asyncImplicitReturn() async { 63 asyncImplicitReturn() async {
64 try {} 64 try {}
65 catch (e) {} 65 catch (e) {}
66 finally {} 66 finally {}
67 } 67 }
68 68
69 main() { 69 main() {
70 var asyncReturn; 70 var asyncReturn;
71 71
72 asyncReturn = asyncIf(true); 72 for (int i = 0; i < 10; i++) {
73 expectThenValue(asyncReturn, 1); 73 asyncReturn = asyncIf(true);
74 asyncReturn = asyncIf(false); 74 expectThenValue(asyncReturn, 1);
75 expectThenValue(asyncReturn, 2); 75 asyncReturn = asyncIf(false);
76 expectThenValue(asyncReturn, 2);
76 77
77 asyncReturn = asyncFor(true); 78 asyncReturn = asyncFor(true);
78 expectThenValue(asyncReturn, 1); 79 expectThenValue(asyncReturn, 1);
79 asyncReturn = asyncFor(false); 80 asyncReturn = asyncFor(false);
80 expectThenValue(asyncReturn, 2); 81 expectThenValue(asyncReturn, 2);
81 82
82 asyncReturn = asyncTryCatchFinally(true, false); 83 asyncReturn = asyncTryCatchFinally(true, false);
83 expectThenValue(asyncReturn, 3); 84 expectThenValue(asyncReturn, 3);
84 asyncReturn = asyncTryCatchFinally(false, false); 85 asyncReturn = asyncTryCatchFinally(false, false);
85 expectThenValue(asyncReturn, 1); 86 expectThenValue(asyncReturn, 1);
86 asyncReturn = asyncTryCatchFinally(true, true); 87 asyncReturn = asyncTryCatchFinally(true, true);
87 expectThenValue(asyncReturn, 3); 88 expectThenValue(asyncReturn, 3);
88 asyncReturn = asyncTryCatchFinally(false, true); 89 asyncReturn = asyncTryCatchFinally(false, true);
89 expectThenValue(asyncReturn, 444); 90 expectThenValue(asyncReturn, 444);
90 asyncReturn = asyncTryCatchLoop(); 91 asyncReturn = asyncTryCatchLoop();
91 expectThenValue(asyncReturn, 13); 92 expectThenValue(asyncReturn, 13);
92 93
93 asyncReturn = asyncImplicitReturn(); 94 asyncReturn = asyncImplicitReturn();
94 expectThenValue(asyncReturn, null); 95 expectThenValue(asyncReturn, null);
96 }
95 } 97 }
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698