[flutter_tools] Fix null check in parsing web plugin from pubspec.yaml (#117939)

* fix null check in parsing web plugin yaml

* revert accidental diff

* remove comment
This commit is contained in:
Christopher Fujino
2023-01-04 12:28:26 -08:00
committed by GitHub
parent 231855fc87
commit 672fe20bde
2 changed files with 29 additions and 8 deletions

View File

@@ -290,6 +290,29 @@ void main() {
]);
});
testWithoutContext('Web plugin tool exits if fileName field missing', () {
final FileSystem fileSystem = MemoryFileSystem.test();
const String pluginYamlRaw =
'platforms:\n'
' web:\n'
' pluginClass: WebSamplePlugin\n';
final YamlMap pluginYaml = loadYaml(pluginYamlRaw) as YamlMap;
expect(
() => Plugin.fromYaml(
_kTestPluginName,
_kTestPluginPath,
pluginYaml,
null,
const <String>[],
fileSystem: fileSystem,
),
throwsToolExit(
message: 'The plugin `$_kTestPluginName` is missing the required field `fileName` in pubspec.yaml',
),
);
});
testWithoutContext('Windows assumes win32 when no variants are given', () {
final FileSystem fileSystem = MemoryFileSystem.test();
const String pluginYamlRaw =