| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2015, 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 import "dart:async"; |
| 6 import "package:expect/expect.dart"; |
| 7 import "package:async_helper/async_helper.dart"; |
| 8 |
| 9 |
| 10 post0(a) async { |
| 11 return await a++; |
| 12 } |
| 13 |
| 14 post1(a) async { |
| 15 return await a++ + await a++; |
| 16 } |
| 17 |
| 18 pref0(a) async { |
| 19 return await ++a; |
| 20 } |
| 21 |
| 22 pref1(a) async { |
| 23 return await ++a + await ++a; |
| 24 } |
| 25 |
| 26 sum(a) async { |
| 27 var s = 0; |
| 28 for (int i = 0; i < a.length; /* nothing */) { |
| 29 s += a[await i++]; |
| 30 } |
| 31 return s; |
| 32 } |
| 33 |
| 34 test() async { |
| 35 Expect.equals(10, await post0(10)); |
| 36 Expect.equals(21, await post1(10)); |
| 37 Expect.equals(11, await pref0(10)); |
| 38 Expect.equals(23, await pref1(10)); |
| 39 Expect.equals(10, await sum([1, 2, 3, 4])); |
| 40 } |
| 41 |
| 42 main() { |
| 43 asyncStart(); |
| 44 test().then((_) { |
| 45 asyncEnd(); |
| 46 }); |
| 47 } |
| OLD | NEW |