use isA<Xxx>() matcher (#48482)

This commit is contained in:
Alexandre Ardhuin
2020-01-16 21:43:03 +01:00
committed by Flutter GitHub Bot
parent 5eb394e084
commit 003541499b
138 changed files with 433 additions and 450 deletions

View File

@@ -22,7 +22,7 @@ export 'package:test_core/test_core.dart' hide TypeMatcher, isInstanceOf; // Def
/// A matcher that compares the type of the actual value to the type argument T.
// TODO(ianh): Remove this once https://github.com/dart-lang/matcher/issues/98 is fixed
Matcher isInstanceOf<T>() => test_package.TypeMatcher<T>();
test_package.TypeMatcher<T> isInstanceOf<T>() => isA<T>();
void tryToDelete(Directory directory) {
// This should not be necessary, but it turns out that
@@ -91,6 +91,9 @@ void updateFileModificationTime(
globals.fs.file(path).setLastModifiedSync(modificationTime);
}
/// Matcher for functions that throw [AssertionError].
final Matcher throwsAssertionError = throwsA(isA<AssertionError>());
/// Matcher for functions that throw [ToolExit].
Matcher throwsToolExit({ int exitCode, Pattern message }) {
Matcher matcher = isToolExit;
@@ -104,7 +107,7 @@ Matcher throwsToolExit({ int exitCode, Pattern message }) {
}
/// Matcher for [ToolExit]s.
final Matcher isToolExit = isInstanceOf<ToolExit>();
final test_package.TypeMatcher<ToolExit> isToolExit = isA<ToolExit>();
/// Matcher for functions that throw [ProcessExit].
Matcher throwsProcessExit([ dynamic exitCode ]) {
@@ -114,7 +117,7 @@ Matcher throwsProcessExit([ dynamic exitCode ]) {
}
/// Matcher for [ProcessExit]s.
final Matcher isProcessExit = isInstanceOf<ProcessExit>();
final test_package.TypeMatcher<ProcessExit> isProcessExit = isA<ProcessExit>();
/// Creates a flutter project in the [temp] directory using the
/// [arguments] list if specified, or `--no-pub` if not.