mirror of
https://github.com/dart-lang/sdk
synced 2024-09-04 16:03:44 +00:00
Fixes async for two other language_2 tests.
Change-Id: Id805a913275468f70cfbe03e37f2534fad6aaab8 Reviewed-on: https://dart-review.googlesource.com/26221 Reviewed-by: Bob Nystrom <rnystrom@google.com>
This commit is contained in:
parent
c1f148ec42
commit
7f91a438f5
|
@ -4,6 +4,7 @@
|
|||
|
||||
import 'dart:async';
|
||||
import 'package:expect/expect.dart';
|
||||
import 'package:async_helper/async_helper.dart';
|
||||
|
||||
typedef Future<Null> Task();
|
||||
|
||||
|
@ -65,8 +66,12 @@ Future<String> world() async {
|
|||
return 'world';
|
||||
}
|
||||
|
||||
Future main() async {
|
||||
var r2 = await world();
|
||||
Expect.equals('hello', r1);
|
||||
Expect.equals('world', r2);
|
||||
void main() {
|
||||
asyncStart();
|
||||
() async {
|
||||
var r2 = await world();
|
||||
Expect.equals('hello', r1);
|
||||
Expect.equals('world', r2);
|
||||
asyncEnd();
|
||||
}();
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
import "dart:async";
|
||||
import "package:expect/expect.dart";
|
||||
import "package:async_helper/async_helper.dart";
|
||||
|
||||
var result = "";
|
||||
|
||||
|
@ -15,14 +16,18 @@ bar() async {
|
|||
result += "bar";
|
||||
}
|
||||
|
||||
main() async {
|
||||
var f = new Future(foo);
|
||||
var b = bar();
|
||||
Expect.equals("", result);
|
||||
scheduleMicrotask(() => result += "micro");
|
||||
await b;
|
||||
await f;
|
||||
main() {
|
||||
asyncStart();
|
||||
() async {
|
||||
var f = new Future(foo);
|
||||
var b = bar();
|
||||
Expect.equals("", result);
|
||||
scheduleMicrotask(() => result += "micro");
|
||||
await b;
|
||||
await f;
|
||||
|
||||
// Validates that bar is scheduled as a microtask, before foo.
|
||||
Expect.equals("barmicrofoo", result);
|
||||
// Validates that bar is scheduled as a microtask, before foo.
|
||||
Expect.equals("barmicrofoo", result);
|
||||
asyncEnd();
|
||||
}();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue