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

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

Issue 772443002: Version 1.8.2 (Closed) Base URL: http://dart.googlecode.com/svn/branches/1.8/
Patch Set: Created 6 years 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 | « dart/sdk/lib/io/http_impl.dart ('k') | dart/tests/standalone/io/http_ipv6_test.dart » ('j') | 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
6 // 6 //
7 // Regression test for issue 21536. 7
8 8
9 import 'dart:async'; 9 import 'dart:async';
10 import 'package:expect/expect.dart'; 10 import 'package:expect/expect.dart';
11 11
12 later(vodka) => new Future.value(vodka); 12 later(vodka) => new Future.value(vodka);
13 13
14 manana(tequila) async => tequila; 14 manana(tequila) async => tequila;
15 15
16 main() async { 16 // Regression test for issue 21536.
17 testNestedFunctions() async {
17 var a = await later('Asterix').then((tonic) { 18 var a = await later('Asterix').then((tonic) {
18 return later(tonic); 19 return later(tonic);
19 }); 20 });
20 var o = await manana('Obelix').then(manana); 21 var o = await manana('Obelix').then(manana);
21 Expect.equals("$a and $o", "Asterix and Obelix"); 22 Expect.equals("$a and $o", "Asterix and Obelix");
22 } 23 }
24
25 addLater({a, b}) => new Future.value(a + b);
26
27 // Regression test for issue 21480.
28 testNamedArguments() async {
29 var sum = await addLater(a:5, b:10);
30 Expect.equals(sum, 15);
31 sum = await addLater(b:11, a:-11);
32 Expect.equals(sum, 0);
33 }
34
35 main() async {
36 testNestedFunctions();
37 testNamedArguments();
38 }
OLDNEW
« no previous file with comments | « dart/sdk/lib/io/http_impl.dart ('k') | dart/tests/standalone/io/http_ipv6_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698