Skip to content

Commit 157336f

Browse files
committed
Allow relative paths in update_static_error_tests.dart
Change-Id: I420145268a8b3451e8bb754d83faf9b0bc42549c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112491 Reviewed-by: Bob Nystrom <[email protected]>
1 parent d8f5970 commit 157336f

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

pkg/test_runner/tool/update_static_error_tests.dart

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,17 @@ Future<void> main(List<String> args) async {
101101
parser, "Must provide a file path or glob for which tests to update.");
102102
}
103103

104-
var glob = Glob(results.rest.single, recursive: true);
105-
for (var entry in glob.listSync(root: "tests")) {
104+
var result = results.rest.single;
105+
// Allow tests to be specified without the extension for compatibility with
106+
// the regular test runner syntax.
107+
if (!result.endsWith(".dart")) {
108+
result += ".dart";
109+
}
110+
// Allow tests to be specified either relative to the "tests" directory
111+
// or relative to the current directory.
112+
var root = result.startsWith("tests") ? "." : "tests";
113+
var glob = Glob(result, recursive: true);
114+
for (var entry in glob.listSync(root: root)) {
106115
if (!entry.path.endsWith(".dart")) continue;
107116

108117
if (entry is File) {

0 commit comments

Comments
 (0)