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 @TestOn("vm") | 5 @TestOn("vm") |
6 library analyzer_cli.test.driver; | 6 library analyzer_cli.test.driver; |
7 | 7 |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 | 9 |
10 import 'package:analyzer/plugin/options.dart'; | 10 import 'package:analyzer/plugin/options.dart'; |
(...skipping 16 matching lines...) Expand all Loading... |
27 driver.start([ | 27 driver.start([ |
28 '--options', | 28 '--options', |
29 'test/data/test_options.yaml', | 29 'test/data/test_options.yaml', |
30 'test/data/test_file.dart' | 30 'test/data/test_file.dart' |
31 ]); | 31 ]); |
32 expect(processor.options['test_plugin'], isNotNull); | 32 expect(processor.options['test_plugin'], isNotNull); |
33 expect(processor.exception, isNull); | 33 expect(processor.exception, isNull); |
34 }); | 34 }); |
35 }); | 35 }); |
36 | 36 |
| 37 group('exit codes', () { |
| 38 int savedExitCode; |
| 39 setUp(() { |
| 40 savedExitCode = exitCode; |
| 41 }); |
| 42 tearDown(() { |
| 43 exitCode = savedExitCode; |
| 44 }); |
| 45 |
| 46 test('fatal hints', () { |
| 47 Driver driver = new Driver(); |
| 48 driver.start(['--fatal-hints', 'test/data/file_with_hint.dart']); |
| 49 expect(exitCode, 3); |
| 50 }); |
| 51 |
| 52 test('not fatal hints', () { |
| 53 Driver driver = new Driver(); |
| 54 driver.start(['test/data/file_with_hint.dart']); |
| 55 expect(exitCode, 0); |
| 56 }); |
| 57 |
| 58 test('fatal errors', () { |
| 59 Driver driver = new Driver(); |
| 60 driver.start(['test/data/file_with_error.dart']); |
| 61 expect(exitCode, 3); |
| 62 }); |
| 63 |
| 64 test('not fatal warnings', () { |
| 65 Driver driver = new Driver(); |
| 66 driver.start(['test/data/file_with_warning.dart']); |
| 67 expect(exitCode, 0); |
| 68 }); |
| 69 |
| 70 test('fatal warnings', () { |
| 71 Driver driver = new Driver(); |
| 72 driver.start(['--fatal-warnings', 'test/data/file_with_warning.dart']); |
| 73 expect(exitCode, 3); |
| 74 }); |
| 75 }); |
| 76 |
37 group('linter', () { | 77 group('linter', () { |
38 StringSink savedOutSink; | 78 StringSink savedOutSink; |
39 Driver driver; | 79 Driver driver; |
40 | 80 |
41 setUp(() { | 81 setUp(() { |
42 savedOutSink = outSink; | 82 savedOutSink = outSink; |
43 outSink = new StringBuffer(); | 83 outSink = new StringBuffer(); |
44 | 84 |
45 driver = new Driver(); | 85 driver = new Driver(); |
46 driver.start([ | 86 driver.start([ |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 @override | 260 @override |
221 void onError(Exception exception) { | 261 void onError(Exception exception) { |
222 this.exception = exception; | 262 this.exception = exception; |
223 } | 263 } |
224 | 264 |
225 @override | 265 @override |
226 void optionsProcessed(Map<String, YamlNode> options) { | 266 void optionsProcessed(Map<String, YamlNode> options) { |
227 this.options = options; | 267 this.options = options; |
228 } | 268 } |
229 } | 269 } |
OLD | NEW |