| 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/domain_analysis.dart'; | 9 import 'package:analysis_server/src/domain_analysis.dart'; |
| 10 import 'package:analyzer/src/generated/engine.dart'; | 10 import 'package:analyzer/src/generated/engine.dart'; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 - $camelCaseTypesLintName | 80 - $camelCaseTypesLintName |
| 81 '''); | 81 '''); |
| 82 | 82 |
| 83 addTestFile('class a { }'); | 83 addTestFile('class a { }'); |
| 84 | 84 |
| 85 Request request = | 85 Request request = |
| 86 new AnalysisSetAnalysisRootsParams([projectPath], []).toRequest('0'); | 86 new AnalysisSetAnalysisRootsParams([projectPath], []).toRequest('0'); |
| 87 handleSuccessfulRequest(request); | 87 handleSuccessfulRequest(request); |
| 88 | 88 |
| 89 return waitForTasksFinished().then((_) { | 89 return waitForTasksFinished().then((_) { |
| 90 // Confirm lint is registered. | |
| 91 expect(lintRegistry, isNotEmpty); | |
| 92 AnalysisContext testContext = server.getContainingContext(testFile); | 90 AnalysisContext testContext = server.getContainingContext(testFile); |
| 93 List<Linter> lints = lintRegistry[testContext]; | 91 List<Linter> lints = getLints(testContext); |
| 94 // Registry should only contain single lint rule. | 92 // Registry should only contain single lint rule. |
| 95 expect(lints, hasLength(1)); | 93 expect(lints, hasLength(1)); |
| 96 LintRule lint = lints.first as LintRule; | 94 LintRule lint = lints.first as LintRule; |
| 97 expect(lint.name, camelCaseTypesLintName); | 95 expect(lint.name, camelCaseTypesLintName); |
| 98 // Verify lint error result. | 96 // Verify lint error result. |
| 99 List<AnalysisError> errors = filesErrors[testFile]; | 97 List<AnalysisError> errors = filesErrors[testFile]; |
| 100 expect(errors, hasLength(1)); | 98 expect(errors, hasLength(1)); |
| 101 AnalysisError error = errors[0]; | 99 AnalysisError error = errors[0]; |
| 102 expect(error.location.file, '/project/bin/test.dart'); | 100 expect(error.location.file, '/project/bin/test.dart'); |
| 103 expect(error.severity, AnalysisErrorSeverity.INFO); | 101 expect(error.severity, AnalysisErrorSeverity.INFO); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 '''); | 145 '''); |
| 148 return waitForTasksFinished().then((_) { | 146 return waitForTasksFinished().then((_) { |
| 149 List<AnalysisError> errors = filesErrors[testFile]; | 147 List<AnalysisError> errors = filesErrors[testFile]; |
| 150 expect(errors, hasLength(1)); | 148 expect(errors, hasLength(1)); |
| 151 AnalysisError error = errors[0]; | 149 AnalysisError error = errors[0]; |
| 152 expect(error.severity, AnalysisErrorSeverity.WARNING); | 150 expect(error.severity, AnalysisErrorSeverity.WARNING); |
| 153 expect(error.type, AnalysisErrorType.STATIC_WARNING); | 151 expect(error.type, AnalysisErrorType.STATIC_WARNING); |
| 154 }); | 152 }); |
| 155 } | 153 } |
| 156 } | 154 } |
| OLD | NEW |