| 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  |  | 
|   7 library analyzer_cli.test.strong_mode; |   6 library analyzer_cli.test.strong_mode; | 
|   8  |   7  | 
|   9 import 'dart:io'; |   8 import 'dart:io'; | 
|  10  |   9  | 
|  11 import 'package:analyzer_cli/src/driver.dart' show Driver, errorSink, outSink; |  10 import 'package:analyzer_cli/src/driver.dart' show Driver, errorSink, outSink; | 
|  12 import 'package:path/path.dart' as path; |  11 import 'package:path/path.dart' as path; | 
|  13 import 'package:test/test.dart'; |  12 import 'package:test/test.dart'; | 
|  14  |  13  | 
 |  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 void main() { | 
|  25   group('--strong', () { |  25   group('--strong', () { | 
|  26     StringSink savedOutSink, savedErrorSink; |  26     StringSink savedOutSink, savedErrorSink; | 
|  27     int savedExitCode; |  27     int savedExitCode; | 
|  28     setUp(() { |  28     setUp(() { | 
|  29       savedOutSink = outSink; |  29       savedOutSink = outSink; | 
|  30       savedErrorSink = errorSink; |  30       savedErrorSink = errorSink; | 
|  31       savedExitCode = exitCode; |  31       savedExitCode = exitCode; | 
|  32       outSink = new StringBuffer(); |  32       outSink = new StringBuffer(); | 
|  33       errorSink = new StringBuffer(); |  33       errorSink = new StringBuffer(); | 
|  34     }); |  34     }); | 
|  35     tearDown(() { |  35     tearDown(() { | 
|  36       outSink = savedOutSink; |  36       outSink = savedOutSink; | 
|  37       errorSink = savedErrorSink; |  37       errorSink = savedErrorSink; | 
|  38       exitCode = savedExitCode; |  38       exitCode = savedExitCode; | 
|  39     }); |  39     }); | 
|  40  |  40  | 
|  41     test('produces stricter errors', () async { |  41     test('produces stricter errors', () async { | 
|  42       var testPath = path.join(testDirectory, 'data/strong_example.dart'); |  42       var testPath = path.join(testDirectory, 'data/strong_example.dart'); | 
|  43       new Driver().start(['--strong', testPath]); |  43       new Driver().start(['--options', emptyOptionsFile, '--strong', testPath]); | 
|  44  |  44  | 
|  45       expect(exitCode, 3); |  45       expect(exitCode, 3); | 
|  46       var stdout = outSink.toString(); |  46       var stdout = outSink.toString(); | 
|  47       expect(stdout, contains('[error] Invalid override')); |  47       expect(stdout, contains('[error] Invalid override')); | 
|  48       expect(stdout, contains('[error] Type check failed')); |  48       expect(stdout, contains('[error] Type check failed')); | 
|  49       expect(stdout, contains('2 errors found.')); |  49       expect(stdout, contains('2 errors found.')); | 
|  50       expect(errorSink.toString(), ''); |  50       expect(errorSink.toString(), ''); | 
|  51     }); |  51     }); | 
|  52   }); |  52   }); | 
|  53 } |  53 } | 
| OLD | NEW |