Chromium Code Reviews| 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/plugin/protocol/protocol.dart'; | |
| 6 import 'package:analyzer/src/generated/engine.dart'; | |
| 7 import 'package:test/test.dart'; | 5 import 'package:test/test.dart'; |
| 8 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 6 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 9 | 7 |
| 10 import '../integration_tests.dart'; | 8 import '../integration_tests.dart'; |
| 11 | 9 |
| 12 main() { | 10 main() { |
| 13 defineReflectiveSuite(() { | 11 defineReflectiveSuite(() { |
| 14 defineReflectiveTests(OptionsIntegrationTest); | 12 defineReflectiveTests(OptionsIntegrationTest); |
| 15 defineReflectiveTests(OptionsIntegrationTest_Driver); | |
| 16 }); | 13 }); |
| 17 } | 14 } |
| 18 | 15 |
| 19 class AbstractOptionsIntegrationTest | |
| 20 extends AbstractAnalysisServerIntegrationTest { | |
| 21 test_option_warning_newOptionFile() async { | |
| 22 String options = sourcePath(AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE); | |
| 23 writeFile( | |
| 24 options, | |
| 25 ''' | |
| 26 linter: | |
| 27 rules: | |
| 28 - camel_case_typo # :) | |
| 29 '''); | |
| 30 | |
| 31 standardAnalysisSetup(); | |
| 32 | |
| 33 await analysisFinished; | |
| 34 | |
| 35 expect(currentAnalysisErrors[options], isList); | |
| 36 List<AnalysisError> errors = currentAnalysisErrors[options]; | |
| 37 expect(errors, hasLength(1)); | |
| 38 AnalysisError error = errors[0]; | |
| 39 expect(error.location.file, options); | |
| 40 expect(error.severity, AnalysisErrorSeverity.WARNING); | |
| 41 expect(error.type, AnalysisErrorType.STATIC_WARNING); | |
| 42 expect(error.location.offset, 23); | |
| 43 expect(error.location.length, 'camel_case_typo'.length); | |
| 44 expect(error.location.startLine, 3); | |
| 45 expect(error.location.startColumn, 7); | |
| 46 } | |
| 47 | |
| 48 test_option_warning_oldOptionFile() async { | |
| 49 String options = sourcePath(AnalysisEngine.ANALYSIS_OPTIONS_FILE); | |
| 50 writeFile( | |
| 51 options, | |
| 52 ''' | |
| 53 linter: | |
| 54 rules: | |
| 55 - camel_case_typo # :) | |
| 56 '''); | |
| 57 | |
| 58 standardAnalysisSetup(); | |
| 59 | |
| 60 await analysisFinished; | |
| 61 | |
| 62 expect(currentAnalysisErrors[options], isList); | |
| 63 List<AnalysisError> errors = currentAnalysisErrors[options]; | |
| 64 expect(errors, hasLength(1)); | |
| 65 AnalysisError error = errors[0]; | |
| 66 expect(error.location.file, options); | |
| 67 expect(error.severity, AnalysisErrorSeverity.WARNING); | |
| 68 expect(error.type, AnalysisErrorType.STATIC_WARNING); | |
| 69 expect(error.location.offset, 23); | |
| 70 expect(error.location.length, 'camel_case_typo'.length); | |
| 71 expect(error.location.startLine, 3); | |
| 72 expect(error.location.startColumn, 7); | |
| 73 } | |
| 74 } | |
| 75 | |
| 76 @reflectiveTest | 16 @reflectiveTest |
| 77 class OptionsIntegrationTest extends AbstractOptionsIntegrationTest {} | 17 class OptionsIntegrationTest extends AbstractAnalysisServerIntegrationTest { |
| 78 | |
| 79 @reflectiveTest | |
| 80 class OptionsIntegrationTest_Driver extends AbstractOptionsIntegrationTest { | |
| 81 @override | |
| 82 bool get enableNewAnalysisDriver => true; | |
| 83 | |
| 84 @failingTest | 18 @failingTest |
| 85 test_option_warning_newOptionFile() async { | 19 test_option_warning_newOptionFile() async { |
| 86 // TimeoutException after 0:00:30.000000: Test timed out after 30 seconds | 20 // TimeoutException after 0:00:30.000000: Test timed out after 30 seconds |
| 87 // (#28868). | 21 // (#28868). |
| 88 //return super.test_option_warning_newOptionFile(); | 22 |
| 89 fail('Test timed out'); | 23 fail('test timeout expected - #28868'); |
| 24 | |
| 25 // String options = sourcePath(AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE); | |
|
Brian Wilkerson
2017/04/17 16:53:52
Given that 'fail' will throw an exception and none
devoncarew
2017/04/17 18:21:58
Ah, great point. Will update to uncomment.
| |
| 26 // writeFile( | |
| 27 // options, | |
| 28 // ''' | |
| 29 //linter: | |
| 30 // rules: | |
| 31 // - camel_case_typo # :) | |
| 32 //'''); | |
| 33 // | |
| 34 // standardAnalysisSetup(); | |
| 35 // | |
| 36 // await analysisFinished; | |
| 37 // | |
| 38 // expect(currentAnalysisErrors[options], isList); | |
| 39 // List<AnalysisError> errors = currentAnalysisErrors[options]; | |
| 40 // expect(errors, hasLength(1)); | |
| 41 // AnalysisError error = errors[0]; | |
| 42 // expect(error.location.file, options); | |
| 43 // expect(error.severity, AnalysisErrorSeverity.WARNING); | |
| 44 // expect(error.type, AnalysisErrorType.STATIC_WARNING); | |
| 45 // expect(error.location.offset, 23); | |
| 46 // expect(error.location.length, 'camel_case_typo'.length); | |
| 47 // expect(error.location.startLine, 3); | |
| 48 // expect(error.location.startColumn, 7); | |
| 90 } | 49 } |
| 91 | 50 |
| 92 @failingTest | 51 @failingTest |
| 93 test_option_warning_oldOptionFile() async { | 52 test_option_warning_oldOptionFile() async { |
| 94 // TimeoutException after 0:00:30.000000: Test timed out after 30 seconds | 53 // TimeoutException after 0:00:30.000000: Test timed out after 30 seconds |
| 95 // (#28868). | 54 // (#28868). |
| 96 //return super.test_option_warning_oldOptionFile(); | 55 |
| 97 fail('Test timed out'); | 56 fail('test timeout expected - #28868'); |
| 57 | |
| 58 // String options = sourcePath(AnalysisEngine.ANALYSIS_OPTIONS_FILE); | |
| 59 // writeFile( | |
| 60 // options, | |
| 61 // ''' | |
| 62 //linter: | |
| 63 // rules: | |
| 64 // - camel_case_typo # :) | |
| 65 //'''); | |
| 66 // | |
| 67 // standardAnalysisSetup(); | |
| 68 // | |
| 69 // await analysisFinished; | |
| 70 // | |
| 71 // expect(currentAnalysisErrors[options], isList); | |
| 72 // List<AnalysisError> errors = currentAnalysisErrors[options]; | |
| 73 // expect(errors, hasLength(1)); | |
| 74 // AnalysisError error = errors[0]; | |
| 75 // expect(error.location.file, options); | |
| 76 // expect(error.severity, AnalysisErrorSeverity.WARNING); | |
| 77 // expect(error.type, AnalysisErrorType.STATIC_WARNING); | |
| 78 // expect(error.location.offset, 23); | |
| 79 // expect(error.location.length, 'camel_case_typo'.length); | |
| 80 // expect(error.location.startLine, 3); | |
| 81 // expect(error.location.startColumn, 7); | |
| 98 } | 82 } |
| 99 } | 83 } |
| OLD | NEW |