Follow up to previous CL

This addresses comments from
https://dart-review.googlesource.com/c/sdk/+/58201.

Change-Id: I59fd5ea06fbd644a7ba5e6be842ce20cfaee7536
Reviewed-on: https://dart-review.googlesource.com/59060
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
This commit is contained in:
Peter von der Ahé 2018-06-07 09:33:52 +00:00 committed by commit-bot@chromium.org
parent 3af09b5b26
commit 656ed8491e
3 changed files with 11 additions and 4 deletions

View file

@ -8,8 +8,8 @@ import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../src/fasta/body_builder_test_helper.dart'; import '../src/fasta/body_builder_test_helper.dart';
import 'parser_test.dart'; import 'parser_test.dart';
main() async { main() {
await CompilerTestContext.runWithTestOptions((_) { return CompilerTestContext.runWithTestOptions((_) {
defineReflectiveSuite(() { defineReflectiveSuite(() {
defineReflectiveTests(ClassMemberParserTest_Forest); defineReflectiveTests(ClassMemberParserTest_Forest);
defineReflectiveTests(ComplexParserTest_Forest); defineReflectiveTests(ComplexParserTest_Forest);

View file

@ -145,6 +145,13 @@ class CompilerTestContext extends CompilerContext {
T result; T result;
Completer<T> completer = new Completer<T>(); Completer<T> completer = new Completer<T>();
// Since we're using `package:test_reflective_loader`, we can't rely on
// normal async behavior, as `defineReflectiveSuite` doesn't return a
// future. However, since it's built on top of `package:test`, we can
// obtain a future that completes when all the tests are done using
// `tearDownAll`. This allows this function to complete no earlier than
// when the tests are done. This is important, as we don't want to call
// `CompilerContext.clear` before then.
tearDownAll(() => completer.complete(result)); tearDownAll(() => completer.complete(result));
result = await action(c); result = await action(c);
return completer.future; return completer.future;

View file

@ -10,8 +10,8 @@ import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../../generated/parser_test.dart'; import '../../generated/parser_test.dart';
import 'body_builder_test_helper.dart'; import 'body_builder_test_helper.dart';
main() async { main() {
await CompilerTestContext.runWithTestOptions((_) { return CompilerTestContext.runWithTestOptions((_) {
defineReflectiveSuite(() { defineReflectiveSuite(() {
defineReflectiveTests(ResolutionTest); defineReflectiveTests(ResolutionTest);
}); });