| Index: pkg/front_end/test/incremental_kernel_generator_test.dart
|
| diff --git a/pkg/front_end/test/incremental_kernel_generator_test.dart b/pkg/front_end/test/incremental_kernel_generator_test.dart
|
| index 8b4aaae5ad6b6f798fea6326c0d83859a63910aa..184c0a1c73bd87087886a557bbb81b9e3716aac4 100644
|
| --- a/pkg/front_end/test/incremental_kernel_generator_test.dart
|
| +++ b/pkg/front_end/test/incremental_kernel_generator_test.dart
|
| @@ -60,15 +60,15 @@ class IncrementalKernelGeneratorTest {
|
| test_acceptLastDelta() async {
|
| writeFile('/test/.packages', 'test:lib/');
|
| String path = '/test/lib/test.dart';
|
| - Uri uri = writeFile(path, 'var v = 1;');
|
| + Uri uri = writeFile(path, '');
|
|
|
| await getInitialState(uri);
|
| incrementalKernelGenerator.acceptLastDelta();
|
|
|
| // Attempt to accept the second time.
|
| - expect(() {
|
| + _assertStateError(() {
|
| incrementalKernelGenerator.acceptLastDelta();
|
| - }, throwsStateError);
|
| + }, IncrementalKernelGeneratorImpl.MSG_NO_LAST_DELTA);
|
| }
|
|
|
| test_compile_chain() async {
|
| @@ -223,6 +223,36 @@ static field asy::Future<core::String> b;
|
| ''');
|
| }
|
|
|
| + test_computeDelta_hasAnotherRunning() async {
|
| + writeFile('/test/.packages', 'test:lib/');
|
| + String path = '/test/lib/test.dart';
|
| + Uri uri = writeFile(path, '');
|
| +
|
| + await getInitialState(uri);
|
| + incrementalKernelGenerator.acceptLastDelta();
|
| +
|
| + // Run, but don't wait.
|
| + var future = incrementalKernelGenerator.computeDelta();
|
| +
|
| + // acceptLastDelta() is failing while the future is pending.
|
| + _assertStateError(() {
|
| + incrementalKernelGenerator.acceptLastDelta();
|
| + }, IncrementalKernelGeneratorImpl.MSG_PENDING_COMPUTE);
|
| +
|
| + // rejectLastDelta() is failing while the future is pending.
|
| + _assertStateError(() {
|
| + incrementalKernelGenerator.rejectLastDelta();
|
| + }, IncrementalKernelGeneratorImpl.MSG_PENDING_COMPUTE);
|
| +
|
| + // Run another, this causes StateError.
|
| + _assertStateError(() {
|
| + incrementalKernelGenerator.computeDelta();
|
| + }, IncrementalKernelGeneratorImpl.MSG_PENDING_COMPUTE);
|
| +
|
| + // Wait for the pending future.
|
| + await future;
|
| + }
|
| +
|
| test_inferPackagesFile() async {
|
| writeFile('/test/.packages', 'test:lib/');
|
| String aPath = '/test/lib/a.dart';
|
| @@ -270,9 +300,9 @@ static field core::int b = a::a;
|
|
|
| // Attempt to reject the last delta twice.
|
| incrementalKernelGenerator.rejectLastDelta();
|
| - expect(() {
|
| + _assertStateError(() {
|
| incrementalKernelGenerator.rejectLastDelta();
|
| - }, throwsStateError);
|
| + }, IncrementalKernelGeneratorImpl.MSG_NO_LAST_DELTA);
|
| }
|
|
|
| test_updateEntryPoint() async {
|
| @@ -455,6 +485,16 @@ import 'a.dart';
|
| }
|
| }
|
|
|
| + /// Assert that invocation of [f] throws a [StateError] with the given [msg].
|
| + void _assertStateError(f(), String msg) {
|
| + try {
|
| + f();
|
| + fail('StateError expected.');
|
| + } on StateError catch (e) {
|
| + expect(e.message, msg);
|
| + }
|
| + }
|
| +
|
| Future<List<int>> _computeSdkOutlineBytes() async {
|
| var options = new CompilerOptions()
|
| ..fileSystem = fileSystem
|
|
|