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:async'; | 7 import 'dart:async'; |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 | 9 |
10 import 'package:analyzer/error/error.dart'; | 10 import 'package:analyzer/error/error.dart'; |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 path.join(testDir, '_packages'), | 315 path.join(testDir, '_packages'), |
316 ], | 316 ], |
317 options: path.join(testDir, '.analysis_options'), | 317 options: path.join(testDir, '.analysis_options'), |
318 ); | 318 ); |
319 expect(exitCode, 3); | 319 expect(exitCode, 3); |
320 expect(outSink.toString(), | 320 expect(outSink.toString(), |
321 contains('but doesn\'t end with a return statement.')); | 321 contains('but doesn\'t end with a return statement.')); |
322 expect(outSink.toString(), contains('isn\'t defined')); | 322 expect(outSink.toString(), contains('isn\'t defined')); |
323 expect(outSink.toString(), contains('Avoid empty else statements.')); | 323 expect(outSink.toString(), contains('Avoid empty else statements.')); |
324 }); | 324 }); |
| 325 |
| 326 test('test strong SDK', () async { |
| 327 String testDir = path.join(testDirectory, 'data', 'strong_sdk'); |
| 328 await drive(path.join(testDir, 'main.dart'), args: ['--strong']); |
| 329 expect(driver.context.analysisOptions.strongMode, isTrue); |
| 330 expect(outSink.toString(), contains('No issues found')); |
| 331 expect(exitCode, 0); |
| 332 }); |
325 }); | 333 }); |
326 | 334 |
327 void createTests(String designator, String optionsFileName) { | 335 void createTests(String designator, String optionsFileName) { |
328 group('build-mode - $designator', () { | 336 group('build-mode - $designator', () { |
329 // Shared driver command. | 337 // Shared driver command. |
330 Future<Null> doDrive(String filePath, | 338 Future<Null> doDrive(String filePath, |
331 {List<String> additionalArgs: const []}) async { | 339 {List<String> additionalArgs: const []}) async { |
332 await drive('file:///test_file.dart|$filePath', | 340 await drive('file:///test_file.dart|$filePath', |
333 args: [ | 341 args: [ |
334 '--dart-sdk', | 342 '--dart-sdk', |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 | 527 |
520 ErrorProcessor processorFor(AnalysisError error) => | 528 ErrorProcessor processorFor(AnalysisError error) => |
521 processors.firstWhere((p) => p.appliesTo(error)); | 529 processors.firstWhere((p) => p.appliesTo(error)); |
522 | 530 |
523 class TestSource implements Source { | 531 class TestSource implements Source { |
524 TestSource(); | 532 TestSource(); |
525 | 533 |
526 @override | 534 @override |
527 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | 535 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
528 } | 536 } |
OLD | NEW |