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.driver; | 5 library analyzer_cli.test.driver; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 | 9 |
10 import 'package:analyzer/error/error.dart'; | 10 import 'package:analyzer/error/error.dart'; |
11 import 'package:analyzer/source/analysis_options_provider.dart'; | 11 import 'package:analyzer/source/analysis_options_provider.dart'; |
12 import 'package:analyzer/source/error_processor.dart'; | 12 import 'package:analyzer/source/error_processor.dart'; |
13 import 'package:analyzer/src/error/codes.dart'; | 13 import 'package:analyzer/src/error/codes.dart'; |
14 import 'package:analyzer/src/generated/engine.dart'; | 14 import 'package:analyzer/src/generated/engine.dart'; |
15 import 'package:analyzer/src/generated/source.dart'; | 15 import 'package:analyzer/src/generated/source.dart'; |
16 import 'package:analyzer/src/services/lint.dart'; | 16 import 'package:analyzer/src/services/lint.dart'; |
17 import 'package:analyzer/src/summary/idl.dart'; | 17 import 'package:analyzer/src/summary/idl.dart'; |
| 18 import 'package:analyzer/src/util/sdk.dart'; |
18 import 'package:analyzer_cli/src/ansi.dart' as ansi; | 19 import 'package:analyzer_cli/src/ansi.dart' as ansi; |
19 import 'package:analyzer_cli/src/driver.dart'; | 20 import 'package:analyzer_cli/src/driver.dart'; |
20 import 'package:analyzer_cli/src/options.dart'; | 21 import 'package:analyzer_cli/src/options.dart'; |
21 import 'package:cli_util/cli_util.dart' show getSdkDir; | |
22 import 'package:path/path.dart' as path; | 22 import 'package:path/path.dart' as path; |
23 import 'package:test/test.dart'; | 23 import 'package:test/test.dart'; |
24 import 'package:yaml/src/yaml_node.dart'; | 24 import 'package:yaml/src/yaml_node.dart'; |
25 | 25 |
26 import 'utils.dart'; | 26 import 'utils.dart'; |
27 | 27 |
28 main() { | 28 main() { |
29 StringSink savedOutSink, savedErrorSink; | 29 StringSink savedOutSink, savedErrorSink; |
30 int savedExitCode; | 30 int savedExitCode; |
31 ExitHandler savedExitHandler; | 31 ExitHandler savedExitHandler; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 path.join(testDirectory, 'data/library_and_parts/part1.dart'), | 126 path.join(testDirectory, 'data/library_and_parts/part1.dart'), |
127 path.join(testDirectory, 'data/library_and_parts/part2.dart') | 127 path.join(testDirectory, 'data/library_and_parts/part2.dart') |
128 ]); | 128 ]); |
129 expect(exitCode, 3); | 129 expect(exitCode, 3); |
130 }); | 130 }); |
131 | 131 |
132 test('bazel workspace relative path', () async { | 132 test('bazel workspace relative path', () async { |
133 // Copy to temp dir so that existing analysis options | 133 // Copy to temp dir so that existing analysis options |
134 // in the test directory hierarchy do not interfere | 134 // in the test directory hierarchy do not interfere |
135 await withTempDirAsync((String tempDirPath) async { | 135 await withTempDirAsync((String tempDirPath) async { |
136 String dartSdkPath = path.absolute(getSdkDir(<String>[]).path); | 136 String dartSdkPath = path.absolute(getSdkPath()); |
137 await recursiveCopy( | 137 await recursiveCopy( |
138 new Directory(path.join(testDirectory, 'data', 'bazel')), | 138 new Directory(path.join(testDirectory, 'data', 'bazel')), |
139 tempDirPath); | 139 tempDirPath); |
140 Directory origWorkingDir = Directory.current; | 140 Directory origWorkingDir = Directory.current; |
141 try { | 141 try { |
142 Directory.current = path.join(tempDirPath, 'proj'); | 142 Directory.current = path.join(tempDirPath, 'proj'); |
143 Driver driver = new Driver(); | 143 Driver driver = new Driver(); |
144 try { | 144 try { |
145 await driver.start([ | 145 await driver.start([ |
146 path.join('lib', 'file.dart'), | 146 path.join('lib', 'file.dart'), |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 | 612 |
613 class TestSource implements Source { | 613 class TestSource implements Source { |
614 TestSource(); | 614 TestSource(); |
615 | 615 |
616 @override | 616 @override |
617 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | 617 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
618 } | 618 } |
619 | 619 |
620 /// Normalize text with bullets. | 620 /// Normalize text with bullets. |
621 String _bulletToDash(item) => '$item'.replaceAll('•', '-'); | 621 String _bulletToDash(item) => '$item'.replaceAll('•', '-'); |
OLD | NEW |