| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 import 'package:analysis_server/protocol/protocol.dart'; | 5 import 'package:analysis_server/protocol/protocol.dart'; |
| 6 import 'package:analysis_server/protocol/protocol_generated.dart' | 6 import 'package:analysis_server/protocol/protocol_generated.dart' |
| 7 hide AnalysisOptions; | 7 hide AnalysisOptions; |
| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 main() { | 97 main() { |
| 98 String unused = ""; | 98 String unused = ""; |
| 99 } | 99 } |
| 100 '''); | 100 '''); |
| 101 | 101 |
| 102 setAnalysisRoot(); | 102 setAnalysisRoot(); |
| 103 | 103 |
| 104 await waitForTasksFinished(); | 104 await waitForTasksFinished(); |
| 105 | 105 |
| 106 // Verify options file. | 106 // Verify options file. |
| 107 if (!enableNewAnalysisDriver) { | 107 // TODO(brianwilkerson) Implement options file analysis in the new driver. |
| 108 // TODO(brianwilkerson) Implement options file analysis in the new driver. | 108 // expect(optionsFileErrors, isNotNull); |
| 109 expect(optionsFileErrors, isNotNull); | 109 // expect(optionsFileErrors, isEmpty); |
| 110 expect(optionsFileErrors, isEmpty); | |
| 111 } | |
| 112 | 110 |
| 113 // Verify test file. | 111 // Verify test file. |
| 114 expect(testFileErrors, isNotNull); | 112 expect(testFileErrors, isNotNull); |
| 115 expect(testFileErrors, isEmpty); | 113 expect(testFileErrors, isEmpty); |
| 116 } | 114 } |
| 117 | 115 |
| 118 test_error_filter_removed() async { | 116 test_error_filter_removed() async { |
| 119 addOptionsFile(''' | 117 addOptionsFile(''' |
| 120 analyzer: | 118 analyzer: |
| 121 errors: | 119 errors: |
| 122 unused_local_variable: ignore | 120 unused_local_variable: ignore |
| 123 '''); | 121 '''); |
| 124 | 122 |
| 125 addTestFile(''' | 123 addTestFile(''' |
| 126 main() { | 124 main() { |
| 127 String unused = ""; | 125 String unused = ""; |
| 128 } | 126 } |
| 129 '''); | 127 '''); |
| 130 | 128 |
| 131 setAnalysisRoot(); | 129 setAnalysisRoot(); |
| 132 | 130 |
| 133 await waitForTasksFinished(); | 131 await waitForTasksFinished(); |
| 134 | 132 |
| 135 // Verify options file. | 133 // Verify options file. |
| 136 if (!enableNewAnalysisDriver) { | 134 // TODO(brianwilkerson) Implement options file analysis in the new driver. |
| 137 // TODO(brianwilkerson) Implement options file analysis in the new driver. | 135 // expect(optionsFileErrors, isNotNull); |
| 138 expect(optionsFileErrors, isNotNull); | 136 // expect(optionsFileErrors, isEmpty); |
| 139 expect(optionsFileErrors, isEmpty); | |
| 140 } | |
| 141 | 137 |
| 142 // Verify test file. | 138 // Verify test file. |
| 143 expect(testFileErrors, isNotNull); | 139 expect(testFileErrors, isNotNull); |
| 144 expect(testFileErrors, isEmpty); | 140 expect(testFileErrors, isEmpty); |
| 145 | 141 |
| 146 addOptionsFile(''' | 142 addOptionsFile(''' |
| 147 analyzer: | 143 analyzer: |
| 148 errors: | 144 errors: |
| 149 # unused_local_variable: ignore | 145 # unused_local_variable: ignore |
| 150 '''); | 146 '''); |
| 151 | 147 |
| 152 await pumpEventQueue(); | 148 await pumpEventQueue(); |
| 153 await waitForTasksFinished(); | 149 await waitForTasksFinished(); |
| 154 | 150 |
| 155 // Verify options file. | 151 // Verify options file. |
| 156 if (!enableNewAnalysisDriver) { | 152 // TODO(brianwilkerson) Implement options file analysis in the new driver. |
| 157 // TODO(brianwilkerson) Implement options file analysis in the new driver. | 153 // expect(optionsFileErrors, isEmpty); |
| 158 expect(optionsFileErrors, isEmpty); | |
| 159 } | |
| 160 | 154 |
| 161 // Verify test file. | 155 // Verify test file. |
| 162 expect(testFileErrors, hasLength(1)); | 156 expect(testFileErrors, hasLength(1)); |
| 163 } | 157 } |
| 164 | 158 |
| 165 test_lint_options_changes() async { | 159 test_lint_options_changes() async { |
| 166 addOptionsFile(''' | 160 addOptionsFile(''' |
| 167 linter: | 161 linter: |
| 168 rules: | 162 rules: |
| 169 - camel_case_types | 163 - camel_case_types |
| (...skipping 24 matching lines...) Expand all Loading... |
| 194 linter: | 188 linter: |
| 195 rules: | 189 rules: |
| 196 - unsupported | 190 - unsupported |
| 197 '''); | 191 '''); |
| 198 | 192 |
| 199 addTestFile(testSource); | 193 addTestFile(testSource); |
| 200 setAnalysisRoot(); | 194 setAnalysisRoot(); |
| 201 | 195 |
| 202 await waitForTasksFinished(); | 196 await waitForTasksFinished(); |
| 203 | 197 |
| 204 if (!enableNewAnalysisDriver) { | 198 // TODO(brianwilkerson) Implement options file analysis in the new driver. |
| 205 // TODO(brianwilkerson) Implement options file analysis in the new driver. | 199 // expect(optionsFileErrors, hasLength(1)); |
| 206 expect(optionsFileErrors, hasLength(1)); | 200 // expect(optionsFileErrors.first.severity, AnalysisErrorSeverity.WARNING); |
| 207 expect(optionsFileErrors.first.severity, AnalysisErrorSeverity.WARNING); | 201 // expect(optionsFileErrors.first.type, AnalysisErrorType.STATIC_WARNING); |
| 208 expect(optionsFileErrors.first.type, AnalysisErrorType.STATIC_WARNING); | |
| 209 } | |
| 210 } | 202 } |
| 211 | 203 |
| 212 test_options_file_added() async { | 204 test_options_file_added() async { |
| 213 addTestFile(testSource); | 205 addTestFile(testSource); |
| 214 setAnalysisRoot(); | 206 setAnalysisRoot(); |
| 215 | 207 |
| 216 await waitForTasksFinished(); | 208 await waitForTasksFinished(); |
| 217 | 209 |
| 218 // Verify strong-mode disabled. | 210 // Verify strong-mode disabled. |
| 219 verifyStrongMode(enabled: false); | 211 verifyStrongMode(enabled: false); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 231 } | 223 } |
| 232 | 224 |
| 233 test_options_file_parse_error() async { | 225 test_options_file_parse_error() async { |
| 234 addOptionsFile(''' | 226 addOptionsFile(''' |
| 235 ; #bang | 227 ; #bang |
| 236 '''); | 228 '''); |
| 237 setAnalysisRoot(); | 229 setAnalysisRoot(); |
| 238 | 230 |
| 239 await waitForTasksFinished(); | 231 await waitForTasksFinished(); |
| 240 | 232 |
| 241 if (!enableNewAnalysisDriver) { | 233 // TODO(brianwilkerson) Implement options file analysis in the new driver. |
| 242 // TODO(brianwilkerson) Implement options file analysis in the new driver. | 234 // expect(optionsFileErrors, hasLength(1)); |
| 243 expect(optionsFileErrors, hasLength(1)); | 235 // expect(optionsFileErrors.first.severity, AnalysisErrorSeverity.ERROR); |
| 244 expect(optionsFileErrors.first.severity, AnalysisErrorSeverity.ERROR); | 236 // expect(optionsFileErrors.first.type, AnalysisErrorType.COMPILE_TIME_ERROR)
; |
| 245 expect( | |
| 246 optionsFileErrors.first.type, AnalysisErrorType.COMPILE_TIME_ERROR); | |
| 247 } | |
| 248 } | 237 } |
| 249 | 238 |
| 250 test_options_file_removed() async { | 239 test_options_file_removed() async { |
| 251 setStrongMode(true); | 240 setStrongMode(true); |
| 252 | 241 |
| 253 addTestFile(testSource); | 242 addTestFile(testSource); |
| 254 setAnalysisRoot(); | 243 setAnalysisRoot(); |
| 255 | 244 |
| 256 await waitForTasksFinished(); | 245 await waitForTasksFinished(); |
| 257 | 246 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 @override | 325 @override |
| 337 String get optionsFilePath => '$projectPath/analysis_options.yaml'; | 326 String get optionsFilePath => '$projectPath/analysis_options.yaml'; |
| 338 } | 327 } |
| 339 | 328 |
| 340 @reflectiveTest | 329 @reflectiveTest |
| 341 class OldAnalysisOptionsFileNotificationTest | 330 class OldAnalysisOptionsFileNotificationTest |
| 342 extends AnalysisOptionsFileNotificationTest { | 331 extends AnalysisOptionsFileNotificationTest { |
| 343 @override | 332 @override |
| 344 String get optionsFilePath => '$projectPath/.analysis_options'; | 333 String get optionsFilePath => '$projectPath/.analysis_options'; |
| 345 } | 334 } |
| OLD | NEW |