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 library analyzer_cli.test.driver; | 5 library analyzer_cli.test.driver; |
6 | 6 |
7 import 'dart:io'; | 7 import 'dart:io'; |
8 | 8 |
9 import 'package:analyzer/error/error.dart'; | 9 import 'package:analyzer/error/error.dart'; |
10 import 'package:analyzer/plugin/options.dart'; | 10 import 'package:analyzer/plugin/options.dart'; |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 expect(outSink.toString(), | 299 expect(outSink.toString(), |
300 contains("[warning] The function 'baz' isn't defined")); | 300 contains("[warning] The function 'baz' isn't defined")); |
301 expect( | 301 expect( |
302 outSink.toString(), contains("1 error and 1 warning found.")); | 302 outSink.toString(), contains("1 error and 1 warning found.")); |
303 }); | 303 }); |
304 }); | 304 }); |
305 } | 305 } |
306 | 306 |
307 createTests('old', AnalysisEngine.ANALYSIS_OPTIONS_FILE); | 307 createTests('old', AnalysisEngine.ANALYSIS_OPTIONS_FILE); |
308 createTests('new', AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE); | 308 createTests('new', AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE); |
| 309 |
| 310 test('include directive', () { |
| 311 String testDir = path.join( |
| 312 testDirectory, 'data', 'options_include_directive_tests_project'); |
| 313 drive( |
| 314 path.join(testDir, 'lib', 'test_file.dart'), |
| 315 args: [ |
| 316 '--fatal-warnings', |
| 317 '--packages', |
| 318 path.join(testDir, '_packages'), |
| 319 ], |
| 320 options: path.join(testDir, '.analysis_options'), |
| 321 ); |
| 322 expect(exitCode, 3); |
| 323 expect(outSink.toString(), |
| 324 contains('but doesn\'t end with a return statement.')); |
| 325 expect(outSink.toString(), contains('isn\'t defined')); |
| 326 expect(outSink.toString(), contains('Avoid empty else statements.')); |
| 327 }); |
309 }); | 328 }); |
310 | 329 |
311 void createTests(String designator, String optionsFileName) { | 330 void createTests(String designator, String optionsFileName) { |
312 group('build-mode - $designator', () { | 331 group('build-mode - $designator', () { |
313 // Shared driver command. | 332 // Shared driver command. |
314 void doDrive(String filePath, {List<String> additionalArgs: const []}) { | 333 void doDrive(String filePath, {List<String> additionalArgs: const []}) { |
315 drive('file:///test_file.dart|$filePath', | 334 drive('file:///test_file.dart|$filePath', |
316 args: [ | 335 args: [ |
317 '--dart-sdk', | 336 '--dart-sdk', |
318 findSdkDirForSummaries(), | 337 findSdkDirForSummaries(), |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 this.options = options; | 553 this.options = options; |
535 } | 554 } |
536 } | 555 } |
537 | 556 |
538 class TestSource implements Source { | 557 class TestSource implements Source { |
539 TestSource(); | 558 TestSource(); |
540 | 559 |
541 @override | 560 @override |
542 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | 561 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
543 } | 562 } |
OLD | NEW |