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

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

Issue 2942433002: Cleanup some unused code in some of the tests (Closed)
Patch Set: Created 3 years, 6 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
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 bc8fe5c102722cea5275c8cda9812753140a6ae6..30d66dd50cfa3f44667f78c50b2072368d29126e 100644
--- a/pkg/analysis_server/test/abstract_single_unit.dart
+++ b/pkg/analysis_server/test/abstract_single_unit.dart
@@ -7,6 +7,7 @@ import 'dart:async';
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/analysis/driver.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';
@@ -96,25 +97,18 @@ class AbstractSingleUnitTest extends AbstractContextTest {
Future<Null> resolveTestUnit(String code) async {
addTestSource(code);
- 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;
- }), isEmpty);
- }
- } else {
- testUnit = await resolveLibraryUnit(testSource);
- if (verifyNoTestUnitErrors) {
- expect(context.getErrors(testSource).errors, isEmpty);
- }
+ AnalysisResult 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;
+ }), isEmpty);
}
testUnitElement = testUnit.element;
testLibraryElement = testUnitElement.library;
« no previous file with comments | « pkg/analysis_server/test/abstract_context.dart ('k') | pkg/analysis_server/test/services/correction/fix_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698