Fail analyzer ID tests if errors are found.

This ensures that we don't accidentally create a test case containing
errors.

Change-Id: I9b6220e15e70640833877f75a08a5a219574be34
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110342
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
This commit is contained in:
Paul Berry 2019-07-31 13:55:54 +00:00 committed by commit-bot@chromium.org
parent 7557a14a74
commit 973a236558

View file

@ -8,6 +8,7 @@
import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/analysis/utilities.dart';
import 'package:analyzer/dart/ast/ast.dart' hide Annotation;
import 'package:analyzer/diagnostic/diagnostic.dart';
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/file_system/memory_file_system.dart';
import 'package:analyzer/src/dart/analysis/byte_store.dart';
@ -135,6 +136,12 @@ Future<bool> runTestForConfig<T>(
scheduler.start();
var result = await driver
.getResult(resourceProvider.convertPath(testData.entryPoint.path));
var errors =
result.errors.where((e) => e.severity == Severity.error).toList();
if (errors.isNotEmpty) {
onFailure('Errors found:\n ${errors.join('\n ')}');
return true;
}
Map<Uri, Map<Id, ActualData<T>>> actualMaps = <Uri, Map<Id, ActualData<T>>>{};
Map<Id, ActualData<T>> globalData = <Id, ActualData<T>>{};