| 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; | 5 library test.analysis.notification_errors; |
| 6 | 6 |
| 7 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 7 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
| 8 import 'package:analysis_server/src/constants.dart'; | 8 import 'package:analysis_server/src/constants.dart'; |
| 9 import 'package:analysis_server/src/context_manager.dart'; | 9 import 'package:analysis_server/src/context_manager.dart'; |
| 10 import 'package:analysis_server/src/domain_analysis.dart'; | 10 import 'package:analysis_server/src/domain_analysis.dart'; |
| 11 import 'package:analyzer/src/dart/analysis/driver.dart'; | 11 import 'package:analyzer/src/dart/analysis/driver.dart'; |
| 12 import 'package:analyzer/src/generated/engine.dart'; | 12 import 'package:analyzer/src/generated/engine.dart'; |
| 13 import 'package:analyzer/src/lint/linter.dart'; |
| 13 import 'package:analyzer/src/services/lint.dart'; | 14 import 'package:analyzer/src/services/lint.dart'; |
| 14 import 'package:linter/src/linter.dart'; | 15 import 'package:linter/src/rules.dart'; |
| 15 import 'package:test/test.dart'; | 16 import 'package:test/test.dart'; |
| 16 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 17 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 17 | 18 |
| 18 import '../analysis_abstract.dart'; | 19 import '../analysis_abstract.dart'; |
| 19 import '../mocks.dart'; | 20 import '../mocks.dart'; |
| 20 | 21 |
| 21 main() { | 22 main() { |
| 22 defineReflectiveSuite(() { | 23 defineReflectiveSuite(() { |
| 23 defineReflectiveTests(NotificationErrorsTest); | 24 defineReflectiveTests(NotificationErrorsTest); |
| 24 defineReflectiveTests(NotificationErrorsTest_Driver); | 25 defineReflectiveTests(NotificationErrorsTest_Driver); |
| 25 }); | 26 }); |
| 26 } | 27 } |
| 27 | 28 |
| 28 @reflectiveTest | 29 @reflectiveTest |
| 29 class AbstractNotificationErrorsTest extends AbstractAnalysisTest { | 30 class AbstractNotificationErrorsTest extends AbstractAnalysisTest { |
| 30 Map<String, List<AnalysisError>> filesErrors = {}; | 31 Map<String, List<AnalysisError>> filesErrors = {}; |
| 31 | 32 |
| 32 void processNotification(Notification notification) { | 33 void processNotification(Notification notification) { |
| 33 if (notification.event == ANALYSIS_ERRORS) { | 34 if (notification.event == ANALYSIS_ERRORS) { |
| 34 var decoded = new AnalysisErrorsParams.fromNotification(notification); | 35 var decoded = new AnalysisErrorsParams.fromNotification(notification); |
| 35 filesErrors[decoded.file] = decoded.errors; | 36 filesErrors[decoded.file] = decoded.errors; |
| 36 } | 37 } |
| 37 } | 38 } |
| 38 | 39 |
| 39 @override | 40 @override |
| 40 void setUp() { | 41 void setUp() { |
| 42 registerLintRules(); |
| 41 super.setUp(); | 43 super.setUp(); |
| 42 server.handlers = [ | 44 server.handlers = [ |
| 43 new AnalysisDomainHandler(server), | 45 new AnalysisDomainHandler(server), |
| 44 ]; | 46 ]; |
| 45 } | 47 } |
| 46 | 48 |
| 47 test_importError() async { | 49 test_importError() async { |
| 48 createProject(); | 50 createProject(); |
| 49 | 51 |
| 50 addTestFile(''' | 52 addTestFile(''' |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 | 158 |
| 157 @reflectiveTest | 159 @reflectiveTest |
| 158 class NotificationErrorsTest_Driver extends AbstractNotificationErrorsTest { | 160 class NotificationErrorsTest_Driver extends AbstractNotificationErrorsTest { |
| 159 @override | 161 @override |
| 160 void setUp() { | 162 void setUp() { |
| 161 enableNewAnalysisDriver = true; | 163 enableNewAnalysisDriver = true; |
| 162 generateSummaryFiles = true; | 164 generateSummaryFiles = true; |
| 163 super.setUp(); | 165 super.setUp(); |
| 164 } | 166 } |
| 165 } | 167 } |
| OLD | NEW |