Throw error on unexpected positional arguments (#130274)
This PR fixes ignoring when random positional arguments added to the `flutter gen-l10n`. So we are no longer able to call `flutter gen-l10n hello world` or `flutter gen-l10n --format false`. Fixes https://github.com/flutter/flutter/issues/118203
This commit is contained in:
@@ -480,4 +480,17 @@ format: true
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => FakeProcessManager.any(),
|
||||
});
|
||||
|
||||
testUsingContext('throws error when unexpected positional argument is provided', () {
|
||||
final GenerateLocalizationsCommand command = GenerateLocalizationsCommand(
|
||||
fileSystem: fileSystem,
|
||||
logger: logger,
|
||||
artifacts: artifacts,
|
||||
processManager: processManager,
|
||||
);
|
||||
expect(
|
||||
() async => createTestCommandRunner(command).run(<String>['gen-l10n', '--synthetic-package', 'false']),
|
||||
throwsToolExit(message: 'Unexpected positional argument "false".')
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user