Unverified Commit c3ec1caa authored by Ferhat's avatar Ferhat Committed by GitHub

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

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

* Update isInstanceOf in flutter tools
parent 40aea479
...@@ -70,7 +70,7 @@ void main() { ...@@ -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']); expect(await channel.invokeListMethod<String>('sayHello', 'hello'), <String>['hello', 'world']);
}); });
...@@ -102,7 +102,7 @@ void main() { ...@@ -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'}); expect(await channel.invokeMapMethod<String, String>('sayHello', 'hello'), <String, String>{'hello': 'world'});
}); });
......
...@@ -105,7 +105,7 @@ void main() { ...@@ -105,7 +105,7 @@ void main() {
]); ]);
fail('Expect exception'); fail('Expect exception');
} on Exception catch (e) { } on Exception catch (e) {
expect(e, isInstanceOf<ToolExit>()); expect(e, isA<ToolExit>());
} }
final BufferLogger bufferLogger = globals.logger as BufferLogger; final BufferLogger bufferLogger = globals.logger as BufferLogger;
expect(bufferLogger.statusText, contains( expect(bufferLogger.statusText, contains(
...@@ -162,7 +162,7 @@ void main() { ...@@ -162,7 +162,7 @@ void main() {
]); ]);
fail('Expect exception'); fail('Expect exception');
} on Exception catch (e) { } on Exception catch (e) {
expect(e, isInstanceOf<ToolExit>()); expect(e, isA<ToolExit>());
expect(e.toString(), contains('No pubspec.yaml file found')); expect(e.toString(), contains('No pubspec.yaml file found'));
} }
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
......
...@@ -77,7 +77,7 @@ void main() { ...@@ -77,7 +77,7 @@ void main() {
androidEnvironment.defines.remove(kBuildMode); androidEnvironment.defines.remove(kBuildMode);
expect( expect(
const KernelSnapshot().build(androidEnvironment), const KernelSnapshot().build(androidEnvironment),
throwsA(isInstanceOf<MissingDefineException>())); throwsA(isA<MissingDefineException>()));
})); }));
test('KernelSnapshot handles null result from kernel compilation', () => testbed.run(() async { test('KernelSnapshot handles null result from kernel compilation', () => testbed.run(() async {
...@@ -328,33 +328,33 @@ void main() { ...@@ -328,33 +328,33 @@ void main() {
androidEnvironment.defines.remove(kBuildMode); androidEnvironment.defines.remove(kBuildMode);
expect(const AotElfProfile().build(androidEnvironment), expect(const AotElfProfile().build(androidEnvironment),
throwsA(isInstanceOf<MissingDefineException>())); throwsA(isA<MissingDefineException>()));
})); }));
test('AotElfProfile throws error if missing target platform', () => testbed.run(() async { test('AotElfProfile throws error if missing target platform', () => testbed.run(() async {
androidEnvironment.defines.remove(kTargetPlatform); androidEnvironment.defines.remove(kTargetPlatform);
expect(const AotElfProfile().build(androidEnvironment), expect(const AotElfProfile().build(androidEnvironment),
throwsA(isInstanceOf<MissingDefineException>())); throwsA(isA<MissingDefineException>()));
})); }));
test('AotAssemblyProfile throws error if missing build mode', () => testbed.run(() async { test('AotAssemblyProfile throws error if missing build mode', () => testbed.run(() async {
iosEnvironment.defines.remove(kBuildMode); iosEnvironment.defines.remove(kBuildMode);
expect(const AotAssemblyProfile().build(iosEnvironment), expect(const AotAssemblyProfile().build(iosEnvironment),
throwsA(isInstanceOf<MissingDefineException>())); throwsA(isA<MissingDefineException>()));
})); }));
test('AotAssemblyProfile throws error if missing target platform', () => testbed.run(() async { test('AotAssemblyProfile throws error if missing target platform', () => testbed.run(() async {
iosEnvironment.defines.remove(kTargetPlatform); iosEnvironment.defines.remove(kTargetPlatform);
expect(const AotAssemblyProfile().build(iosEnvironment), expect(const AotAssemblyProfile().build(iosEnvironment),
throwsA(isInstanceOf<MissingDefineException>())); throwsA(isA<MissingDefineException>()));
})); }));
test('AotAssemblyProfile throws error if built for non-iOS platform', () => testbed.run(() async { test('AotAssemblyProfile throws error if built for non-iOS platform', () => testbed.run(() async {
expect(const AotAssemblyProfile().build(androidEnvironment), expect(const AotAssemblyProfile().build(androidEnvironment),
throwsA(isInstanceOf<Exception>())); throwsA(isA<Exception>()));
})); }));
test('AotAssemblyProfile generates multiple arches and lipos together', () => testbed.run(() async { test('AotAssemblyProfile generates multiple arches and lipos together', () => testbed.run(() async {
......
...@@ -95,7 +95,7 @@ void main() { ...@@ -95,7 +95,7 @@ void main() {
ProcessUtils: () => null, ProcessUtils: () => null,
}); });
expect(() => testbed.run(() {}), throwsA(isInstanceOf<StateError>())); expect(() => testbed.run(() {}), throwsA(isA<StateError>()));
}); });
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment