mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
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:
parent
40aea47992
commit
c3ec1caac2
@ -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'});
|
||||
});
|
||||
|
||||
|
@ -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>{
|
||||
|
@ -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 {
|
||||
|
@ -95,7 +95,7 @@ void main() {
|
||||
ProcessUtils: () => null,
|
||||
});
|
||||
|
||||
expect(() => testbed.run(() {}), throwsA(isInstanceOf<StateError>()));
|
||||
expect(() => testbed.run(() {}), throwsA(isA<StateError>()));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user