Migrate customer_testing to null safety (#80841)

This commit is contained in:
Abhishek Ghaskata 2021-04-22 23:26:51 +05:30 committed by GitHub
parent 78d931ea4f
commit a84ac2ec2c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 10 deletions

View file

@ -15,7 +15,7 @@ Future<bool> runTests({
bool verbose = false,
int numberShards = 1,
int shardIndex = 0,
List<File> files,
required List<File> files,
}) async {
if (verbose)
print('Starting run_tests.dart...');
@ -66,7 +66,7 @@ Future<bool> runTests({
if (verbose)
print('Created temporary directory: ${checkout.path}');
try {
bool success;
bool? success;
bool showContacts = false;
for (final String fetchCommand in instructions.fetch) {
success = await shell(fetchCommand, checkout, verbose: verbose, silentFailure: skipOnFetchFailure);
@ -86,7 +86,7 @@ Future<bool> runTests({
}
}
assert(success != null);
if (success) {
if (success == true) {
if (verbose)
print('Running tests...');
final Directory tests = Directory(path.join(checkout.path, 'tests'));
@ -105,7 +105,7 @@ Future<bool> runTests({
}
}
}
if (verbose && success)
if (verbose && success == true)
print('Tests finished.');
}
if (showContacts) {

View file

@ -2,7 +2,7 @@ name: customer_testing
description: Tool to run the tests listed in the flutter/tests repository.
environment:
sdk: '>=2.9.0 <3.0.0'
sdk: '>=2.12.0 <3.0.0'
dependencies:
args: 2.0.0

View file

@ -78,13 +78,13 @@ Future<bool> run(List<String> arguments) async {
exit(1);
}
final int repeat = int.tryParse(parsedArguments['repeat'] as String);
final int? repeat = int.tryParse(parsedArguments['repeat'] as String);
final bool skipOnFetchFailure = parsedArguments['skip-on-fetch-failure'] as bool;
final bool skipTemplate = parsedArguments['skip-template'] as bool;
final bool verbose = parsedArguments['verbose'] as bool;
final bool help = parsedArguments['help'] as bool;
final int numberShards = int.tryParse(parsedArguments['shards'] as String);
final int shardIndex = int.tryParse(parsedArguments['shard-index'] as String);
final int? numberShards = int.tryParse(parsedArguments['shards'] as String);
final int? shardIndex = int.tryParse(parsedArguments['shard-index'] as String);
final List<File> files = parsedArguments
.rest
.expand((String path) => Glob(path).listFileSystemSync(const LocalFileSystem()))
@ -106,10 +106,10 @@ Future<bool> run(List<String> arguments) async {
return help;
}
if (files.length < shardIndex)
if (files.length < shardIndex!)
print('Warning: There are more shards than tests. Some shards will not run any tests.');
if (numberShards <= shardIndex) {
if (numberShards! <= shardIndex) {
print('Error: There are more shard indexes than shards.');
return help;
}