mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 17:40:04 +00:00
[tests] Use asyncStart/asyncEnd for two language tests
In order for asynchronous tests to work on the web, they have to tell the test runner that * the test is async * when the async test has finished running This is done via calling asyncStart/asyncEnd. Issue https://github.com/dart-lang/sdk/issues/52631 Issue https://github.com/dart-lang/sdk/issues/55865 Change-Id: I790960d7da708de4e36be9197ceb3e89f316a84e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/368581 Reviewed-by: Ömer Ağacan <omersa@google.com> Commit-Queue: Martin Kustermann <kustermann@google.com>
This commit is contained in:
parent
51ea22f13f
commit
a4d3ee054d
|
@ -6,7 +6,10 @@
|
|||
// when applied to interfaces that have `Future` as a superinterface.
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:async_helper/async_helper.dart';
|
||||
import 'package:expect/expect.dart';
|
||||
|
||||
import '../static_type_helper.dart';
|
||||
|
||||
mixin Base {
|
||||
|
@ -39,6 +42,7 @@ class Divergent<T> = Object
|
|||
implements Future<Divergent<Divergent<T>>>;
|
||||
|
||||
void main() async {
|
||||
asyncStart();
|
||||
// ----- Test the static types of await on the non-standard futures.
|
||||
|
||||
bool obscureFalse = DateTime.now().millisecondsSinceEpoch < 0;
|
||||
|
@ -142,4 +146,5 @@ void main() async {
|
|||
} on Divergent {
|
||||
// Expected throw.
|
||||
}
|
||||
asyncEnd();
|
||||
}
|
||||
|
|
|
@ -2,9 +2,11 @@
|
|||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import 'package:async_helper/async_helper.dart';
|
||||
|
||||
// Test that it is an error to use nullable types in unsound ways.
|
||||
void main() async {
|
||||
asyncStart();
|
||||
int? x;
|
||||
bool? cond;
|
||||
List? list;
|
||||
|
@ -54,6 +56,7 @@ void main() async {
|
|||
assert(cond); //# 38: compile-time error
|
||||
[...list]; //# 39: compile-time error
|
||||
[...?list]; //# 40: ok
|
||||
asyncEnd();
|
||||
}
|
||||
|
||||
generator() sync* {
|
||||
|
|
Loading…
Reference in a new issue