Skip to content

Commit 184fd50

Browse files
johnniwinthercommit-bot@chromium.org
authored andcommitted
[test_runner] Support multiple arguments in update_static_error_tests.dart
This improves usability of the tool when a multiple tests needs updating. Change-Id: I034e3da7381ae79b2149429e5271904e0dfcae59 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210862 Reviewed-by: Jens Johansen <[email protected]> Commit-Queue: Johnni Winther <[email protected]>
1 parent 89ba203 commit 184fd50

File tree

1 file changed

+20
-25
lines changed

1 file changed

+20
-25
lines changed

pkg/test_runner/tool/update_static_error_tests.dart

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -112,32 +112,27 @@ Future<void> main(List<String> args) async {
112112
parser, "Must provide at least one flag for an operation to perform.");
113113
}
114114

115-
if (results.rest.length != 1) {
116-
_usageError(
117-
parser, "Must provide a file path or glob for which tests to update.");
118-
}
119-
120-
var result = results.rest.single;
121-
122-
// Allow tests to be specified without the extension for compatibility with
123-
// the regular test runner syntax.
124-
if (!result.endsWith(".dart")) {
125-
result += ".dart";
126-
}
115+
for (var result in results.rest) {
116+
// Allow tests to be specified without the extension for compatibility with
117+
// the regular test runner syntax.
118+
if (!result.endsWith(".dart")) {
119+
result += ".dart";
120+
}
127121

128-
// Allow tests to be specified either relative to the "tests" directory
129-
// or relative to the current directory.
130-
var root = result.startsWith("tests") ? "." : "tests";
131-
var glob = Glob(result, recursive: true);
132-
for (var entry in glob.listSync(root: root)) {
133-
if (!entry.path.endsWith(".dart")) continue;
134-
135-
if (entry is pkg_file.File) {
136-
await _processFile(entry,
137-
dryRun: dryRun,
138-
includeContext: includeContext,
139-
remove: removeSources,
140-
insert: insertSources);
122+
// Allow tests to be specified either relative to the "tests" directory
123+
// or relative to the current directory.
124+
var root = result.startsWith("tests") ? "." : "tests";
125+
var glob = Glob(result, recursive: true);
126+
for (var entry in glob.listSync(root: root)) {
127+
if (!entry.path.endsWith(".dart")) continue;
128+
129+
if (entry is pkg_file.File) {
130+
await _processFile(entry,
131+
dryRun: dryRun,
132+
includeContext: includeContext,
133+
remove: removeSources,
134+
insert: insertSources);
135+
}
141136
}
142137
}
143138
}

0 commit comments

Comments
 (0)