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.super_mixin; | 5 library analyzer_cli.test.super_mixin; |
6 | 6 |
7 import 'dart:io'; | 7 import 'dart:io'; |
8 | 8 |
9 import 'package:analyzer_cli/src/driver.dart' show Driver, errorSink, outSink; | 9 import 'package:analyzer_cli/src/driver.dart' show Driver, errorSink, outSink; |
10 import 'package:path/path.dart' as path; | 10 import 'package:path/path.dart' as path; |
(...skipping 20 matching lines...) Expand all Loading... |
31 errorSink = new StringBuffer(); | 31 errorSink = new StringBuffer(); |
32 }); | 32 }); |
33 tearDown(() { | 33 tearDown(() { |
34 outSink = savedOutSink; | 34 outSink = savedOutSink; |
35 errorSink = savedErrorSink; | 35 errorSink = savedErrorSink; |
36 exitCode = savedExitCode; | 36 exitCode = savedExitCode; |
37 }); | 37 }); |
38 | 38 |
39 test('produces errors when option absent', () async { | 39 test('produces errors when option absent', () async { |
40 var testPath = path.join(testDirectory, 'data/super_mixin_example.dart'); | 40 var testPath = path.join(testDirectory, 'data/super_mixin_example.dart'); |
41 new Driver().start([testPath]); | 41 await new Driver().start([testPath]); |
42 | 42 |
43 expect(exitCode, 3); | 43 expect(exitCode, 3); |
44 var stdout = outSink.toString(); | 44 var stdout = outSink.toString(); |
45 expect( | 45 expect( |
46 stdout, | 46 stdout, |
47 contains( | 47 contains( |
48 "[error] The class 'C' can't be used as a mixin because it extends
a class other than Object")); | 48 "[error] The class 'C' can't be used as a mixin because it extends
a class other than Object")); |
49 expect( | 49 expect( |
50 stdout, | 50 stdout, |
51 contains( | 51 contains( |
52 "[error] The class 'C' can't be used as a mixin because it referen
ces 'super'")); | 52 "[error] The class 'C' can't be used as a mixin because it referen
ces 'super'")); |
53 expect(stdout, contains('2 errors found.')); | 53 expect(stdout, contains('2 errors found.')); |
54 expect(errorSink.toString(), ''); | 54 expect(errorSink.toString(), ''); |
55 }); | 55 }); |
56 | 56 |
57 test('produces no errors when option present', () async { | 57 test('produces no errors when option present', () async { |
58 var testPath = path.join(testDirectory, 'data/super_mixin_example.dart'); | 58 var testPath = path.join(testDirectory, 'data/super_mixin_example.dart'); |
59 new Driver().start(['--supermixin', testPath]); | 59 await new Driver().start(['--supermixin', testPath]); |
60 | 60 |
61 expect(exitCode, 0); | 61 expect(exitCode, 0); |
62 var stdout = outSink.toString(); | 62 var stdout = outSink.toString(); |
63 expect(stdout, contains('No issues found')); | 63 expect(stdout, contains('No issues found')); |
64 }); | 64 }); |
65 }); | 65 }); |
66 } | 66 } |
OLD | NEW |