Replace isInstanceOf<T> uses with isA<T> (#53834)

* Replace isInstanceOf<T> uses with isA<T>

* Update isInstanceOf in flutter tools
This commit is contained in:
Ferhat 2020-04-02 10:57:07 -07:00 committed by GitHub
parent 40aea47992
commit c3ec1caac2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 11 deletions

View File

@ -70,7 +70,7 @@ void main() {
}
},
);
expect(channel.invokeMethod<List<String>>('sayHello', 'hello'), throwsA(isInstanceOf<TypeError>()));
expect(channel.invokeMethod<List<String>>('sayHello', 'hello'), throwsA(isA<TypeError>()));
expect(await channel.invokeListMethod<String>('sayHello', 'hello'), <String>['hello', 'world']);
});
@ -102,7 +102,7 @@ void main() {
}
},
);
expect(channel.invokeMethod<Map<String, String>>('sayHello', 'hello'), throwsA(isInstanceOf<TypeError>()));
expect(channel.invokeMethod<Map<String, String>>('sayHello', 'hello'), throwsA(isA<TypeError>()));
expect(await channel.invokeMapMethod<String, String>('sayHello', 'hello'), <String, String>{'hello': 'world'});
});

View File

@ -105,7 +105,7 @@ void main() {
]);
fail('Expect exception');
} on Exception catch (e) {
expect(e, isInstanceOf<ToolExit>());
expect(e, isA<ToolExit>());
}
final BufferLogger bufferLogger = globals.logger as BufferLogger;
expect(bufferLogger.statusText, contains(
@ -162,7 +162,7 @@ void main() {
]);
fail('Expect exception');
} on Exception catch (e) {
expect(e, isInstanceOf<ToolExit>());
expect(e, isA<ToolExit>());
expect(e.toString(), contains('No pubspec.yaml file found'));
}
}, overrides: <Type, Generator>{

View File

@ -77,7 +77,7 @@ void main() {
androidEnvironment.defines.remove(kBuildMode);
expect(
const KernelSnapshot().build(androidEnvironment),
throwsA(isInstanceOf<MissingDefineException>()));
throwsA(isA<MissingDefineException>()));
}));
test('KernelSnapshot handles null result from kernel compilation', () => testbed.run(() async {
@ -328,33 +328,33 @@ void main() {
androidEnvironment.defines.remove(kBuildMode);
expect(const AotElfProfile().build(androidEnvironment),
throwsA(isInstanceOf<MissingDefineException>()));
throwsA(isA<MissingDefineException>()));
}));
test('AotElfProfile throws error if missing target platform', () => testbed.run(() async {
androidEnvironment.defines.remove(kTargetPlatform);
expect(const AotElfProfile().build(androidEnvironment),
throwsA(isInstanceOf<MissingDefineException>()));
throwsA(isA<MissingDefineException>()));
}));
test('AotAssemblyProfile throws error if missing build mode', () => testbed.run(() async {
iosEnvironment.defines.remove(kBuildMode);
expect(const AotAssemblyProfile().build(iosEnvironment),
throwsA(isInstanceOf<MissingDefineException>()));
throwsA(isA<MissingDefineException>()));
}));
test('AotAssemblyProfile throws error if missing target platform', () => testbed.run(() async {
iosEnvironment.defines.remove(kTargetPlatform);
expect(const AotAssemblyProfile().build(iosEnvironment),
throwsA(isInstanceOf<MissingDefineException>()));
throwsA(isA<MissingDefineException>()));
}));
test('AotAssemblyProfile throws error if built for non-iOS platform', () => testbed.run(() async {
expect(const AotAssemblyProfile().build(androidEnvironment),
throwsA(isInstanceOf<Exception>()));
throwsA(isA<Exception>()));
}));
test('AotAssemblyProfile generates multiple arches and lipos together', () => testbed.run(() async {

View File

@ -95,7 +95,7 @@ void main() {
ProcessUtils: () => null,
});
expect(() => testbed.run(() {}), throwsA(isInstanceOf<StateError>()));
expect(() => testbed.run(() {}), throwsA(isA<StateError>()));
});
});
}