Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Side by Side Diff: pkg/analyzer_cli/test/package_prefix_test.dart

Issue 2658863002: Run analyzer_cli asynchronously. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/analyzer_cli/test/embedder_test.dart ('k') | pkg/analyzer_cli/test/sdk_ext_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 import 'dart:async';
1 import 'dart:io' show exitCode; 2 import 'dart:io' show exitCode;
2 3
3 import 'package:analyzer_cli/src/driver.dart' show Driver, outSink, errorSink; 4 import 'package:analyzer_cli/src/driver.dart' show Driver, outSink, errorSink;
4 import 'package:analyzer_cli/src/options.dart' show ExitHandler, exitHandler; 5 import 'package:analyzer_cli/src/options.dart' show ExitHandler, exitHandler;
5 import 'package:path/path.dart'; 6 import 'package:path/path.dart';
6 import 'package:test/test.dart'; 7 import 'package:test/test.dart';
7 8
8 import 'utils.dart' show testDirectory; 9 import 'utils.dart' show testDirectory;
9 10
10 main() { 11 main() {
11 group('--x-package-warnings-prefix', () { 12 group('--x-package-warnings-prefix', () {
12 _Runner runner; 13 _Runner runner;
13 14
14 setUp(() { 15 setUp(() {
15 runner = new _Runner.setUp(); 16 runner = new _Runner.setUp();
16 }); 17 });
17 18
18 tearDown(() { 19 tearDown(() {
19 runner.tearDown(); 20 runner.tearDown();
20 runner = null; 21 runner = null;
21 }); 22 });
22 23
23 test('shows only the hint whose package matches the prefix', () { 24 test('shows only the hint whose package matches the prefix', () async {
24 runner.run([ 25 await runner.run2([
25 "--packages", 26 "--packages",
26 join(testDirectory, 'data', 'package_prefix', 'packagelist'), 27 join(testDirectory, 'data', 'package_prefix', 'packagelist'),
27 "--x-package-warnings-prefix=f", 28 "--x-package-warnings-prefix=f",
28 join(testDirectory, 'data', 'package_prefix', 'main.dart') 29 join(testDirectory, 'data', 'package_prefix', 'main.dart')
29 ]); 30 ]);
30 expect(runner.stdout, contains('1 hint found')); 31 expect(runner.stdout, contains('1 hint found'));
31 expect(runner.stdout, contains('Unused import')); 32 expect(runner.stdout, contains('Unused import'));
32 expect(runner.stdout, 33 expect(runner.stdout,
33 contains(join('package_prefix', 'pkg', 'foo', 'foo.dart'))); 34 contains(join('package_prefix', 'pkg', 'foo', 'foo.dart')));
34 expect(runner.stdout, isNot(contains('bar.dart'))); 35 expect(runner.stdout, isNot(contains('bar.dart')));
(...skipping 16 matching lines...) Expand all
51 _savedExitHandler = exitHandler, 52 _savedExitHandler = exitHandler,
52 _savedExitCode = exitCode { 53 _savedExitCode = exitCode {
53 outSink = _stdout; 54 outSink = _stdout;
54 errorSink = _stderr; 55 errorSink = _stderr;
55 exitHandler = (_) {}; 56 exitHandler = (_) {};
56 } 57 }
57 58
58 String get stderr => _stderr.toString(); 59 String get stderr => _stderr.toString();
59 60
60 String get stdout => _stdout.toString(); 61 String get stdout => _stdout.toString();
61 void run(List<String> args) { 62
62 new Driver().start(args); 63 Future<Null> run2(List<String> args) async {
64 await new Driver().start(args);
63 if (stderr.isNotEmpty) { 65 if (stderr.isNotEmpty) {
64 fail("Unexpected output to stderr:\n$stderr"); 66 fail("Unexpected output to stderr:\n$stderr");
65 } 67 }
66 } 68 }
67 69
68 void tearDown() { 70 void tearDown() {
69 outSink = _savedOutSink; 71 outSink = _savedOutSink;
70 errorSink = _savedErrorSink; 72 errorSink = _savedErrorSink;
71 exitCode = _savedExitCode; 73 exitCode = _savedExitCode;
72 exitHandler = _savedExitHandler; 74 exitHandler = _savedExitHandler;
73 } 75 }
74 } 76 }
OLDNEW
« no previous file with comments | « pkg/analyzer_cli/test/embedder_test.dart ('k') | pkg/analyzer_cli/test/sdk_ext_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698