assertDiagnostics method

Future<void> assertDiagnostics(
  1. String content,
  2. List<ExpectedDiagnostic> expectedDiagnostics
)
inherited

Asserts that the number of diagnostics reported in content matches the number of expectedDiagnostics and that they have the expected error descriptions and locations.

The order in which the diagnostics were gathered is ignored.

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

Implementation

Future<void> assertDiagnostics(
  String content,
  List<ExpectedDiagnostic> expectedDiagnostics,
) async {
  _addTestFile(content);
  await _resolveTestFile();
  assertDiagnosticsIn(_diagnostics, expectedDiagnostics);
}