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

Unified Diff: pkg/analysis_server/test/analysis/notification_errors_test.dart

Issue 2545553007: Add support for generating lints when using the new driver (Closed)
Patch Set: Created 4 years 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 | « pkg/analysis_server/lib/src/context_manager.dart ('k') | pkg/analysis_server/test/analysis_abstract.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/analysis/notification_errors_test.dart
diff --git a/pkg/analysis_server/test/analysis/notification_errors_test.dart b/pkg/analysis_server/test/analysis/notification_errors_test.dart
index 8ab02c39e482b2c35b2575783696f5844c7b8b30..3725e82b6eac8bafcb31f9dea83f5a33aec47710 100644
--- a/pkg/analysis_server/test/analysis/notification_errors_test.dart
+++ b/pkg/analysis_server/test/analysis/notification_errors_test.dart
@@ -6,7 +6,9 @@ library test.analysis.notification_errors;
import 'package:analysis_server/plugin/protocol/protocol.dart';
import 'package:analysis_server/src/constants.dart';
+import 'package:analysis_server/src/context_manager.dart';
import 'package:analysis_server/src/domain_analysis.dart';
+import 'package:analyzer/src/dart/analysis/driver.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:analyzer/src/services/lint.dart';
import 'package:linter/src/linter.dart';
@@ -18,11 +20,12 @@ import '../analysis_abstract.dart';
main() {
defineReflectiveSuite(() {
defineReflectiveTests(NotificationErrorsTest);
+ defineReflectiveTests(NotificationErrorsTest_Driver);
});
}
@reflectiveTest
-class NotificationErrorsTest extends AbstractAnalysisTest {
+class AbstractNotificationErrorsTest extends AbstractAnalysisTest {
Map<String, List<AnalysisError>> filesErrors = {};
void processNotification(Notification notification) {
@@ -75,8 +78,16 @@ linter:
handleSuccessfulRequest(request);
await waitForTasksFinished();
- AnalysisContext testContext = server.getContainingContext(testFile);
- List<Linter> lints = getLints(testContext);
+ List<Linter> lints;
+ if (enableNewAnalysisDriver) {
+ AnalysisDriver testDriver = (server.contextManager as ContextManagerImpl)
+ .getContextInfoFor(resourceProvider.getFolder(projectPath))
+ .analysisDriver;
+ lints = testDriver.analysisOptions.lintRules;
+ } else {
+ AnalysisContext testContext = server.getContainingContext(testFile);
+ lints = getLints(testContext);
+ }
// Registry should only contain single lint rule.
expect(lints, hasLength(1));
LintRule lint = lints.first as LintRule;
@@ -135,3 +146,40 @@ main() {
expect(error.type, AnalysisErrorType.STATIC_WARNING);
}
}
+
+@reflectiveTest
+class NotificationErrorsTest extends AbstractNotificationErrorsTest {}
+
+@reflectiveTest
+class NotificationErrorsTest_Driver extends AbstractNotificationErrorsTest {
+ @override
+ void setUp() {
+ enableNewAnalysisDriver = true;
+ generateSummaryFiles = true;
+ super.setUp();
+ }
+
+ @failingTest
+ @override
+ test_importError() {
+ // The overridden test is failing because we're not getting any error
+ // notifications.
scheglov 2016/12/02 22:36:58 We might get error notifications, just too late fo
Brian Wilkerson 2016/12/02 22:51:30 Is there a way to wait until all communications fr
scheglov 2016/12/02 22:52:31 I don't know it.
+ return super.test_importError();
+ }
+
+ @failingTest
+ @override
+ test_ParserError() {
+ // The overridden test is failing because we're not getting any error
+ // notifications.
+ return super.test_ParserError();
+ }
+
+ @failingTest
+ @override
+ test_StaticWarning() {
+ // The overridden test is failing because we're not getting any error
+ // notifications.
+ return super.test_StaticWarning();
+ }
+}
« no previous file with comments | « pkg/analysis_server/lib/src/context_manager.dart ('k') | pkg/analysis_server/test/analysis_abstract.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698