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

Unified Diff: pkg/analysis_server/test/abstract_single_unit.dart

Issue 2617833002: Run AssistProcessor tests with the new analysis driver. (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/correction/assist_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/abstract_single_unit.dart
diff --git a/pkg/analysis_server/test/abstract_single_unit.dart b/pkg/analysis_server/test/abstract_single_unit.dart
index 779fa6b16389e7efcc98a915b318179e8c572345..b5154761d7cb7a8ba82e0542dce26e2b48ef7e83 100644
--- a/pkg/analysis_server/test/abstract_single_unit.dart
+++ b/pkg/analysis_server/test/abstract_single_unit.dart
@@ -9,6 +9,7 @@ import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/error/error.dart';
import 'package:analyzer/src/dart/ast/utilities.dart';
+import 'package:analyzer/src/dart/error/hint_codes.dart';
import 'package:analyzer/src/generated/java_engine.dart';
import 'package:analyzer/src/generated/source.dart';
import 'package:test/test.dart';
@@ -30,11 +31,6 @@ class AbstractSingleUnitTest extends AbstractContextTest {
testSource = addSource(testFile, code, uri);
}
- void assertNoErrorsInSource(Source source) {
- List<AnalysisError> errors = context.getErrors(source).errors;
- expect(errors, isEmpty);
- }
-
Element findElement(String name, [ElementKind kind]) {
return findChildElement(testUnitElement, name, kind);
}
@@ -101,9 +97,26 @@ class AbstractSingleUnitTest extends AbstractContextTest {
Future<Null> resolveTestUnit(String code) async {
addTestSource(code);
- testUnit = await resolveLibraryUnit(testSource);
- if (verifyNoTestUnitErrors) {
- assertNoErrorsInSource(testSource);
+ if (enableNewAnalysisDriver) {
+ var result = await driver.getResult(testFile);
+ testUnit = (result).unit;
+ if (verifyNoTestUnitErrors) {
+ expect(result.errors.where((AnalysisError error) {
+ return
+ error.errorCode != HintCode.DEAD_CODE &&
+ error.errorCode != HintCode.UNUSED_CATCH_CLAUSE &&
+ error.errorCode != HintCode.UNUSED_CATCH_STACK &&
+ error.errorCode != HintCode.UNUSED_ELEMENT &&
+ error.errorCode != HintCode.UNUSED_FIELD &&
+ error.errorCode != HintCode.UNUSED_IMPORT &&
+ error.errorCode != HintCode.UNUSED_LOCAL_VARIABLE;
Brian Wilkerson 2017/01/06 00:01:40 Why do we need to filter here when we don't need t
scheglov 2017/01/06 00:03:28 The old driver does not generate hints.
Brian Wilkerson 2017/01/06 00:07:37 Perhaps a comment to that effect? And it might be
+ }), isEmpty);
+ }
+ } else {
+ testUnit = await resolveLibraryUnit(testSource);
+ if (verifyNoTestUnitErrors) {
+ expect(context.getErrors(testSource).errors, isEmpty);
+ }
}
testUnitElement = testUnit.element;
testLibraryElement = testUnitElement.library;
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/correction/assist_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698