mirror of
https://github.com/dart-lang/sdk
synced 2024-10-04 16:35:01 +00:00
Issue 45556. Analyze a requested file, even if it is excluded.
Bug: https://github.com/dart-lang/sdk/issues/45556 Change-Id: I5077759b2929540a3631712a09fce951c3732b51 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207400 Reviewed-by: Samuel Rawlins <srawlins@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
parent
6a8e74e656
commit
f258c7fe62
|
@ -382,7 +382,7 @@ class Driver implements CommandLineStarter {
|
|||
Iterable<io.File> _collectFiles(String filePath, AnalysisOptions options) {
|
||||
var files = <io.File>[];
|
||||
var file = io.File(filePath);
|
||||
if (file.existsSync() && !pathFilter.ignored(filePath)) {
|
||||
if (file.existsSync()) {
|
||||
files.add(file);
|
||||
} else {
|
||||
var directory = io.Directory(filePath);
|
||||
|
|
|
@ -73,7 +73,9 @@ class BaseTest {
|
|||
path.join(testDirectory, options),
|
||||
];
|
||||
}
|
||||
cmd..addAll(sources.map(_adjustFileSpec))..addAll(args);
|
||||
cmd
|
||||
..addAll(sources.map(_adjustFileSpec))
|
||||
..addAll(args);
|
||||
|
||||
await driver.start(cmd);
|
||||
}
|
||||
|
@ -390,6 +392,20 @@ class OptionsTest extends BaseTest {
|
|||
ErrorProcessor processorFor(AnalysisError error) =>
|
||||
processors.firstWhere((p) => p.appliesTo(error));
|
||||
|
||||
/// If a file is specified explicitly, it should be analyzed, even if
|
||||
/// it is excluded. Excludes work when an including directory is specified.
|
||||
Future<void> test_analysisOptions_excluded_requested() async {
|
||||
await drive(
|
||||
'data/exclude_test_project/lib/excluded_error.dart',
|
||||
options: 'data/exclude_test_project/$analysisOptionsYaml',
|
||||
);
|
||||
expect(
|
||||
bulletToDash(outSink),
|
||||
contains("error - Undefined class 'ExcludedUndefinedClass'"),
|
||||
);
|
||||
expect(outSink.toString(), contains('1 error found.'));
|
||||
}
|
||||
|
||||
Future<void> test_analysisOptions_excludes() async {
|
||||
await drive('data/exclude_test_project',
|
||||
options: 'data/exclude_test_project/$analysisOptionsYaml');
|
||||
|
|
Loading…
Reference in a new issue