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

Unified Diff: pkg/front_end/lib/src/fasta/testing/suite.dart

Issue 2824393002: Introduce a testing framework for use with fasta type inference. (Closed)
Patch Set: Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: pkg/front_end/lib/src/fasta/testing/suite.dart
diff --git a/pkg/front_end/lib/src/fasta/testing/suite.dart b/pkg/front_end/lib/src/fasta/testing/suite.dart
index 1a42e1d8646e61ea14297885b45222d37a964ee8..28535e686f047da504346745cb893ef95c94a5a8 100644
--- a/pkg/front_end/lib/src/fasta/testing/suite.dart
+++ b/pkg/front_end/lib/src/fasta/testing/suite.dart
@@ -10,6 +10,9 @@ import 'dart:convert' show JSON;
import 'package:analyzer/src/generated/sdk.dart' show DartSdk;
+import 'package:front_end/src/fasta/testing/validating_instrumentation.dart'
+ show ValidatingInstrumentation;
+
import 'package:kernel/ast.dart' show Library, Program;
import 'package:analyzer/src/kernel/loader.dart' show DartLoader;
@@ -161,7 +164,10 @@ class Outline extends Step<TestDescription, Program, FastaContext> {
final bool strongMode;
- const Outline(this.fullCompile, this.astKind, this.strongMode);
+ const Outline(this.fullCompile, this.astKind, this.strongMode,
+ {this.updateExpectations: false});
+
+ final bool updateExpectations;
String get name {
return fullCompile ? "${astKind} compile" : "outline";
@@ -185,9 +191,20 @@ class Outline extends Step<TestDescription, Program, FastaContext> {
try {
sourceTarget.read(description.uri);
await dillTarget.writeOutline(null);
+ var instrumentation = new ValidatingInstrumentation();
+ await instrumentation.loadExpectations(description.uri);
+ sourceTarget.loader.instrumentation = instrumentation;
p = await sourceTarget.writeOutline(null);
if (fullCompile) {
p = await sourceTarget.writeProgram(null);
+ instrumentation.finish();
+ if (instrumentation.hasProblems) {
+ if (updateExpectations) {
+ await instrumentation.fixSource(description.uri);
+ } else {
+ return fail(null, instrumentation.problemsAsString);
+ }
+ }
}
} on InputError catch (e, s) {
return fail(null, e.error, s);

Powered by Google App Engine
This is Rietveld 408576698