| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library test.analysis.notification_errors; | |
| 6 | |
| 7 import 'package:analysis_server/protocol/protocol.dart'; | 5 import 'package:analysis_server/protocol/protocol.dart'; |
| 8 import 'package:analysis_server/protocol/protocol_generated.dart'; | 6 import 'package:analysis_server/protocol/protocol_generated.dart'; |
| 9 import 'package:analysis_server/src/constants.dart'; | 7 import 'package:analysis_server/src/constants.dart'; |
| 10 import 'package:analysis_server/src/context_manager.dart'; | 8 import 'package:analysis_server/src/context_manager.dart'; |
| 11 import 'package:analysis_server/src/domain_analysis.dart'; | 9 import 'package:analysis_server/src/domain_analysis.dart'; |
| 12 import 'package:analyzer/src/dart/analysis/driver.dart'; | 10 import 'package:analyzer/src/dart/analysis/driver.dart'; |
| 13 import 'package:analyzer/src/generated/engine.dart'; | 11 import 'package:analyzer/src/generated/engine.dart'; |
| 14 import 'package:analyzer/src/lint/linter.dart'; | 12 import 'package:analyzer/src/lint/linter.dart'; |
| 15 import 'package:analyzer/src/services/lint.dart'; | 13 import 'package:analyzer/src/services/lint.dart'; |
| 16 import 'package:linter/src/rules.dart'; | 14 import 'package:linter/src/rules.dart'; |
| 17 import 'package:test/test.dart'; | 15 import 'package:test/test.dart'; |
| 18 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 16 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 19 | 17 |
| 20 import '../analysis_abstract.dart'; | 18 import '../analysis_abstract.dart'; |
| 21 import '../mocks.dart'; | 19 import '../mocks.dart'; |
| 22 | 20 |
| 23 main() { | 21 main() { |
| 24 defineReflectiveSuite(() { | 22 defineReflectiveSuite(() { |
| 25 defineReflectiveTests(NotificationErrorsTest); | 23 defineReflectiveTests(NotificationErrorsTest); |
| 26 defineReflectiveTests(NotificationErrorsTest_Driver); | |
| 27 }); | 24 }); |
| 28 } | 25 } |
| 29 | 26 |
| 30 @reflectiveTest | 27 @reflectiveTest |
| 31 class AbstractNotificationErrorsTest extends AbstractAnalysisTest { | 28 class NotificationErrorsTest extends AbstractAnalysisTest { |
| 32 Map<String, List<AnalysisError>> filesErrors = {}; | 29 Map<String, List<AnalysisError>> filesErrors = {}; |
| 33 | 30 |
| 34 void processNotification(Notification notification) { | 31 void processNotification(Notification notification) { |
| 35 if (notification.event == ANALYSIS_ERRORS) { | 32 if (notification.event == ANALYSIS_ERRORS) { |
| 36 var decoded = new AnalysisErrorsParams.fromNotification(notification); | 33 var decoded = new AnalysisErrorsParams.fromNotification(notification); |
| 37 filesErrors[decoded.file] = decoded.errors; | 34 filesErrors[decoded.file] = decoded.errors; |
| 38 } | 35 } |
| 39 } | 36 } |
| 40 | 37 |
| 41 @override | 38 @override |
| 42 void setUp() { | 39 void setUp() { |
| 40 enableNewAnalysisDriver = true; |
| 41 generateSummaryFiles = true; |
| 43 registerLintRules(); | 42 registerLintRules(); |
| 44 super.setUp(); | 43 super.setUp(); |
| 45 server.handlers = [ | 44 server.handlers = [ |
| 46 new AnalysisDomainHandler(server), | 45 new AnalysisDomainHandler(server), |
| 47 ]; | 46 ]; |
| 48 } | 47 } |
| 49 | 48 |
| 50 test_importError() async { | 49 test_importError() async { |
| 51 createProject(); | 50 createProject(); |
| 52 | 51 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 '''); | 145 '''); |
| 147 await waitForTasksFinished(); | 146 await waitForTasksFinished(); |
| 148 await pumpEventQueue(); | 147 await pumpEventQueue(); |
| 149 List<AnalysisError> errors = filesErrors[testFile]; | 148 List<AnalysisError> errors = filesErrors[testFile]; |
| 150 expect(errors, hasLength(1)); | 149 expect(errors, hasLength(1)); |
| 151 AnalysisError error = errors[0]; | 150 AnalysisError error = errors[0]; |
| 152 expect(error.severity, AnalysisErrorSeverity.WARNING); | 151 expect(error.severity, AnalysisErrorSeverity.WARNING); |
| 153 expect(error.type, AnalysisErrorType.STATIC_WARNING); | 152 expect(error.type, AnalysisErrorType.STATIC_WARNING); |
| 154 } | 153 } |
| 155 } | 154 } |
| 156 | |
| 157 @reflectiveTest | |
| 158 class NotificationErrorsTest extends AbstractNotificationErrorsTest {} | |
| 159 | |
| 160 @reflectiveTest | |
| 161 class NotificationErrorsTest_Driver extends AbstractNotificationErrorsTest { | |
| 162 @override | |
| 163 void setUp() { | |
| 164 enableNewAnalysisDriver = true; | |
| 165 generateSummaryFiles = true; | |
| 166 super.setUp(); | |
| 167 } | |
| 168 } | |
| OLD | NEW |