assertPubspecDiagnostics method

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

Asserts that expectedDiagnostics are reported when resolving content.

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

Implementation

Future<void> assertPubspecDiagnostics(
  String content,
  List<ExpectedDiagnostic> expectedDiagnostics,
) async {
  newFile(testPackagePubspecPath, content);
  var errors = await _analyzePubspecFile(content);
  assertDiagnosticsIn(errors, expectedDiagnostics);
}