fix(i18n): add a test for plurality of required flags

This commit is contained in:
Goutte 2023-04-04 10:40:59 +02:00
parent 64f5c4f405
commit 102ab5b544

View file

@ -815,6 +815,21 @@ func TestPersistentFlagsOnChild(t *testing.T) {
}
}
func TestRequiredFlag(t *testing.T) {
c := &Command{Use: "c", Run: emptyRun}
c.Flags().String("foo1", "", "")
assertNoErr(t, c.MarkFlagRequired("foo1"))
expected := fmt.Sprintf("required flag %q is not set", "foo1")
_, err := executeCommand(c)
got := err.Error()
if got != expected {
t.Errorf("Expected error: %q, got: %q", expected, got)
}
}
func TestRequiredFlags(t *testing.T) {
c := &Command{Use: "c", Run: emptyRun}
c.Flags().String("foo1", "", "")