assertDiagnosticsInUnits method

Future<void> assertDiagnosticsInUnits(
  1. List<(String, List<ExpectedDiagnostic>)> unitsAndDiagnostics
)
inherited

Asserts that the diagnostics for each path match those in the paired expectedDiagnostics.

The unit at each path needs to have already been written to the file system before calling this method.

Note: Be sure to await any use of this API, to avoid stale analysis results (See DisposedAnalysisContextResult).

Implementation

Future<void> assertDiagnosticsInUnits(
  List<(String path, List<ExpectedDiagnostic> expectedDiagnostics)>
  unitsAndDiagnostics,
) async {
  for (var (path, expectedDiagnostics) in unitsAndDiagnostics) {
    result = await resolveFile(convertPath(path));
    assertDiagnosticsIn(result.diagnostics, expectedDiagnostics);
  }
}