[Doctor] Improve CocoaPods messages (#146701)
This tweaks the Flutter doctor messages for CocoaPods.
This also switches the "unknown version" error to link to the update instructions instead of the installation instructions; the user has already installed CocoaPods in this scenario.
Example error before:
```
â CocoaPods not installed.
CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
```
Example error after:
```
â CocoaPods not installed.
CocoaPods is a package manager for iOS or macOS platform code.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
For installation instructions, see https://guides.cocoapods.org/using/getting-started.html#installation
```
This commit is contained in:
@@ -16,18 +16,32 @@ void main() {
|
||||
final CocoaPodsValidator workflow = CocoaPodsValidator(FakeCocoaPods(CocoaPodsStatus.recommended, '1000.0.0'), UserMessages());
|
||||
final ValidationResult result = await workflow.validate();
|
||||
expect(result.type, ValidationType.success);
|
||||
expect(result.messages.length, 1);
|
||||
final ValidationMessage message = result.messages.first;
|
||||
expect(message.type, ValidationMessageType.information);
|
||||
expect(message.message, contains('CocoaPods version 1000.0.0'));
|
||||
});
|
||||
|
||||
testWithoutContext('Emits missing status when CocoaPods is not installed', () async {
|
||||
final CocoaPodsValidator workflow = CocoaPodsValidator(FakeCocoaPods(CocoaPodsStatus.notInstalled), UserMessages());
|
||||
final ValidationResult result = await workflow.validate();
|
||||
expect(result.type, ValidationType.missing);
|
||||
expect(result.messages.length, 1);
|
||||
final ValidationMessage message = result.messages.first;
|
||||
expect(message.type, ValidationMessageType.error);
|
||||
expect(message.message, contains('CocoaPods not installed'));
|
||||
expect(message.message, contains('getting-started.html#installation'));
|
||||
});
|
||||
|
||||
testWithoutContext('Emits partial status when CocoaPods is installed with unknown version', () async {
|
||||
final CocoaPodsValidator workflow = CocoaPodsValidator(FakeCocoaPods(CocoaPodsStatus.unknownVersion), UserMessages());
|
||||
final ValidationResult result = await workflow.validate();
|
||||
expect(result.type, ValidationType.partial);
|
||||
expect(result.messages.length, 1);
|
||||
final ValidationMessage message = result.messages.first;
|
||||
expect(message.type, ValidationMessageType.hint);
|
||||
expect(message.message, contains('Unknown CocoaPods version installed'));
|
||||
expect(message.message, contains('getting-started.html#updating-cocoapods'));
|
||||
});
|
||||
|
||||
testWithoutContext('Emits partial status when CocoaPods version is too low', () async {
|
||||
|
||||
Reference in New Issue
Block a user