Validate empty pubspec plugin section (#51503)
This commit is contained in:
@@ -177,6 +177,9 @@ class Plugin {
|
||||
}
|
||||
|
||||
static List<String> validatePluginYaml(YamlMap yaml) {
|
||||
if (yaml == null) {
|
||||
return <String>['Invalid "plugin" specification.'];
|
||||
}
|
||||
|
||||
final bool usesOldPluginFormat = const <String>{
|
||||
'androidPackage',
|
||||
|
||||
@@ -158,6 +158,16 @@ void main() {
|
||||
expect(plugin.platforms, <String, PluginPlatform> {});
|
||||
});
|
||||
|
||||
test('error on empty plugin', () {
|
||||
const String pluginYamlRaw = '';
|
||||
|
||||
final YamlMap pluginYaml = loadYaml(pluginYamlRaw) as YamlMap;
|
||||
expect(
|
||||
() => Plugin.fromYaml(_kTestPluginName, _kTestPluginPath, pluginYaml, const <String>[]),
|
||||
throwsToolExit(message: 'Invalid "plugin" specification.'),
|
||||
);
|
||||
});
|
||||
|
||||
test('error on empty platforms', () {
|
||||
const String pluginYamlRaw = 'platforms:\n';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user