Skip to content

Commit ea8b520

Browse files
munificentCommit Queue
authored andcommitted
Add support to update_static_error_tests.dart to skip non-error files.
I'm slowly going through and reformatting the tests. That also means regenerating the static error expectations because of #57042. But I don't need to generate static error markers for files that don't already have them. So this adds a flag to the test updater to let it skip over any test file that isn't already known to be a static error test. Change-Id: I61f10d29924f1f9d2dabf61bb604e53a6622017f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394940 Auto-Submit: Bob Nystrom <[email protected]> Reviewed-by: Nicholas Shahan <[email protected]> Commit-Queue: Bob Nystrom <[email protected]>
1 parent c8ff99d commit ea8b520

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pkg/test_runner/tool/update_static_error_tests.dart

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ Future<void> main(List<String> args) async {
3838
negatable: false);
3939
parser.addFlag("context",
4040
abbr: "c", help: "Include context messages in output.");
41+
parser.addFlag("only-static-error-tests",
42+
abbr: "o",
43+
help: "Skips files that don't already have static error expectations.",
44+
negatable: false);
4145

4246
parser.addSeparator("What operations to perform:");
4347
parser.addFlag("remove-all",
@@ -76,6 +80,7 @@ Future<void> main(List<String> args) async {
7680
var dryRun = results["dry-run"] as bool;
7781

7882
var includeContext = results["context"] as bool;
83+
var onlyStaticErrorTests = results["only-static-error-tests"] as bool;
7984

8085
var removeSources = <ErrorSource>{};
8186
var insertSources = <ErrorSource>{};
@@ -133,6 +138,7 @@ Future<void> main(List<String> args) async {
133138
entry,
134139
dryRun: dryRun,
135140
includeContext: includeContext,
141+
onlyStaticErrorTests: onlyStaticErrorTests,
136142
remove: removeSources,
137143
insert: insertSources,
138144
);
@@ -172,6 +178,7 @@ void _usageError(ArgParser parser, String message) {
172178
Future<bool> _processFile(File file,
173179
{required bool dryRun,
174180
required bool includeContext,
181+
required bool onlyStaticErrorTests,
175182
required Set<ErrorSource> remove,
176183
required Set<ErrorSource> insert}) async {
177184
var testFile = TestFile.read(Path("."), file.absolute.path);
@@ -187,6 +194,11 @@ Future<bool> _processFile(File file,
187194
// but not both.
188195
if (testFile.isMultitest) return false;
189196

197+
if (onlyStaticErrorTests && testFile.expectedErrors.isEmpty) {
198+
print("Skip ${file.path} since it isn't a static error test.");
199+
return true;
200+
}
201+
190202
stdout.write("${file.path}...");
191203

192204
var experiments = [

0 commit comments

Comments
 (0)