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.strong_mode; | 6 library analyzer_cli.test.strong_mode; |
7 | 7 |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 | 9 |
10 import 'package:analyzer_cli/src/driver.dart' show Driver, errorSink, outSink; | 10 import 'package:analyzer_cli/src/driver.dart' show Driver, errorSink, outSink; |
11 import 'package:path/path.dart' as path; | 11 import 'package:path/path.dart' as path; |
12 import 'package:test/test.dart'; | 12 import 'package:test/test.dart'; |
13 | 13 |
14 import 'driver_test.dart'; | 14 import 'driver_test.dart'; |
15 import 'utils.dart'; | 15 import 'utils.dart'; |
16 | 16 |
17 /// End-to-end test for --strong checking. | 17 /// End-to-end test for --strong checking. |
18 /// | 18 /// |
19 /// Most strong mode tests are in Analyzer, but this verifies the option is | 19 /// Most strong mode tests are in Analyzer, but this verifies the option is |
20 /// working and producing extra errors as expected. | 20 /// working and producing extra errors as expected. |
21 /// | 21 /// |
22 /// Generally we don't want a lot of cases here as it requires spinning up a | 22 /// Generally we don't want a lot of cases here as it requires spinning up a |
23 /// full analysis context. | 23 /// full analysis context. |
24 void main() { | 24 /// |
| 25 // TODO(pq): fix tests to run safely on the bots |
| 26 // https://github.com/dart-lang/sdk/issues/25001 |
| 27 main () {} |
| 28 _main() { |
25 group('--strong', () { | 29 group('--strong', () { |
26 StringSink savedOutSink, savedErrorSink; | 30 StringSink savedOutSink, savedErrorSink; |
27 int savedExitCode; | 31 int savedExitCode; |
28 setUp(() { | 32 setUp(() { |
29 savedOutSink = outSink; | 33 savedOutSink = outSink; |
30 savedErrorSink = errorSink; | 34 savedErrorSink = errorSink; |
31 savedExitCode = exitCode; | 35 savedExitCode = exitCode; |
32 outSink = new StringBuffer(); | 36 outSink = new StringBuffer(); |
33 errorSink = new StringBuffer(); | 37 errorSink = new StringBuffer(); |
34 }); | 38 }); |
35 tearDown(() { | 39 tearDown(() { |
36 outSink = savedOutSink; | 40 outSink = savedOutSink; |
37 errorSink = savedErrorSink; | 41 errorSink = savedErrorSink; |
38 exitCode = savedExitCode; | 42 exitCode = savedExitCode; |
39 }); | 43 }); |
40 | 44 |
41 test('produces stricter errors', () async { | 45 test('produces stricter errors', () async { |
42 var testPath = path.join(testDirectory, 'data/strong_example.dart'); | 46 var testPath = path.join(testDirectory, 'data/strong_example.dart'); |
43 new Driver().start(['--options', emptyOptionsFile, '--strong', testPath]); | 47 new Driver().start(['--options', emptyOptionsFile, '--strong', testPath]); |
44 | 48 |
45 expect(exitCode, 3); | 49 expect(exitCode, 3); |
46 var stdout = outSink.toString(); | 50 var stdout = outSink.toString(); |
47 expect(stdout, contains('[error] Invalid override')); | 51 expect(stdout, contains('[error] Invalid override')); |
48 expect(stdout, contains('[error] Type check failed')); | 52 expect(stdout, contains('[error] Type check failed')); |
49 expect(stdout, contains('2 errors found.')); | 53 expect(stdout, contains('2 errors found.')); |
50 expect(errorSink.toString(), ''); | 54 expect(errorSink.toString(), ''); |
51 }); | 55 }); |
52 }); | 56 }); |
53 } | 57 } |
OLD | NEW |