Unverified Commit e31521ea authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Validate empty pubspec plugin section (#51503)

parent f794091e
......@@ -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';
......
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