[flutter_tools] remove globals from FlutterValidator, add documentation and move tests to new file (#67234)

Remove globals from the flutter validator class, and refactor the tests into a separate file. Applies some other cleanup like adding doc comments, and making the doctor validator work like it is documented to work - removing the gen_snapshot check if the artifact is not downloaded instead of downloading all android artifacts.

#47161
This commit is contained in:
Jonah Williams
2020-10-05 17:58:56 -07:00
committed by GitHub
parent 2474b07768
commit 1271447bbe
6 changed files with 242 additions and 154 deletions

View File

@@ -9,6 +9,7 @@ import 'package:args/command_runner.dart';
import 'package:flutter_tools/src/base/logger.dart';
import 'package:flutter_tools/src/base/platform.dart';
import 'package:flutter_tools/src/convert.dart';
import 'package:flutter_tools/src/doctor.dart';
import 'package:vm_service/vm_service.dart' as vm_service;
import 'package:path/path.dart' as path; // ignore: package_path_import
@@ -413,3 +414,15 @@ class ConfiguredFileSystem extends ForwardingFileSystem {
return (entities[path] as Directory) ?? super.directory(path);
}
}
/// Matches a doctor validation result.
Matcher matchDoctorValidation({
ValidationType validationType,
String statusInfo,
dynamic messages
}) {
return const test_package.TypeMatcher<ValidationResult>()
.having((ValidationResult result) => result.type, 'type', validationType)
.having((ValidationResult result) => result.statusInfo, 'statusInfo', statusInfo)
.having((ValidationResult result) => result.messages, 'messages', messages);
}