mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Update logic for parsing sdk version number (#15918)
* add logic to parse 11.3 sim runtime major version * add null aware and bump group number * add comment describing version
This commit is contained in:
parent
68db514ec0
commit
0c89920069
@ -441,11 +441,11 @@ class IOSSimulator extends Device {
|
||||
@override
|
||||
Future<String> get sdkNameAndVersion async => category;
|
||||
|
||||
final RegExp _iosSdkRegExp = new RegExp(r'iOS (\d+)');
|
||||
final RegExp _iosSdkRegExp = new RegExp(r'iOS( |-)(\d+)');
|
||||
|
||||
Future<int> get sdkMajorVersion async {
|
||||
final Match sdkMatch = _iosSdkRegExp.firstMatch(await sdkNameAndVersion);
|
||||
return int.parse(sdkMatch.group(1) ?? 11);
|
||||
return int.parse(sdkMatch?.group(2) ?? 11);
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -94,6 +94,21 @@ void main() {
|
||||
});
|
||||
});
|
||||
|
||||
group('sdkMajorVersion', () {
|
||||
// This new version string appears in SimulatorApp-850 CoreSimulator-518.16 beta.
|
||||
test('can be parsed from iOS-11-3', () async {
|
||||
final IOSSimulator device = new IOSSimulator('x', name: 'iPhone SE', category: 'com.apple.CoreSimulator.SimRuntime.iOS-11-3');
|
||||
|
||||
expect(await device.sdkMajorVersion, 11);
|
||||
});
|
||||
|
||||
test('can be parsed from iOS 11.2', () async {
|
||||
final IOSSimulator device = new IOSSimulator('x', name: 'iPhone SE', category: 'iOS 11.2');
|
||||
|
||||
expect(await device.sdkMajorVersion, 11);
|
||||
});
|
||||
});
|
||||
|
||||
group('IOSSimulator.isSupported', () {
|
||||
testUsingContext('Apple TV is unsupported', () {
|
||||
expect(new IOSSimulator('x', name: 'Apple TV').isSupported(), false);
|
||||
|
Loading…
Reference in New Issue
Block a user