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

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

Issue 839323003: Implementation of async-await transformation on js ast. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Implement new ssa-nodes in ssa-tracer. Created 5 years, 10 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
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 5
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'package:expect/expect.dart'; 8 import 'package:expect/expect.dart';
9 9
10 later(vodka) => new Future.value(vodka); 10 later(vodka) => new Future.value(vodka);
11 11
12 manana(tequila) async => tequila; 12 manana(tequila) async => tequila;
13 13
14 // Regression test for issue 21536. 14 // Regression test for issue 21536.
15 testNestedFunctions() async { 15 testNestedFunctions() async {
16 var a = await later('Asterix').then((tonic) { 16 var a = await (later('Asterix').then((tonic) {
floitsch 2015/02/02 22:00:12 why this change?
sigurdm 2015/02/03 16:59:33 ditto
17 return later(tonic); 17 return later(tonic);
18 }); 18 }));
19 var o = await manana('Obelix').then(manana); 19 var o = await (manana('Obelix').then(manana));
floitsch 2015/02/02 22:00:12 ditto.
sigurdm 2015/02/03 16:59:33 ditto
20 Expect.equals("$a and $o", "Asterix and Obelix"); 20 Expect.equals("$a and $o", "Asterix and Obelix");
21 } 21 }
22 22
23 addLater({a, b}) => new Future.value(a + b); 23 addLater({a, b}) => new Future.value(a + b);
24 24
25 // Regression test for issue 21480. 25 // Regression test for issue 21480.
26 testNamedArguments() async { 26 testNamedArguments() async {
27 var sum = await addLater(a:5, b:10); 27 var sum = await addLater(a:5, b:10);
28 Expect.equals(sum, 15); 28 Expect.equals(sum, 15);
29 sum = await addLater(b:11, a:-11); 29 sum = await addLater(b:11, a:-11);
30 Expect.equals(sum, 0); 30 Expect.equals(sum, 0);
31 } 31 }
32 32
33 main() async { 33 main() async {
34 testNestedFunctions(); 34 testNestedFunctions();
35 testNamedArguments(); 35 testNamedArguments();
36 } 36 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698