From 8c5f1fb359a8f7c2995e823b7248a0ba0b46149f Mon Sep 17 00:00:00 2001 From: Naveen Gogineni Date: Sat, 23 Apr 2022 19:30:34 -0400 Subject: [PATCH] Changes from code review --- flag_test.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/flag_test.go b/flag_test.go index f662feefa8..ecb7847ed3 100644 --- a/flag_test.go +++ b/flag_test.go @@ -2063,17 +2063,19 @@ func TestTimestampFlagApply_WithDestination(t *testing.T) { // Test issue #1254 // StringSlice() with UseShortOptionHandling causes duplicated entries, depending on the ordering of the flags func TestSliceShortOptionHandle(t *testing.T) { - _ = (&App{ + wasCalled := false + err := (&App{ Commands: []*Command{ { Name: "foobar", UseShortOptionHandling: true, Action: func(ctx *Context) error { + wasCalled = true if ctx.Bool("i") != true { - t.Errorf("bool i not set") + t.Error("bool i not set") } if ctx.Bool("t") != true { - t.Errorf("bool i not set") + t.Error("bool i not set") } ss := ctx.StringSlice("net") if !reflect.DeepEqual(ss, []string{"foo"}) { @@ -2089,4 +2091,10 @@ func TestSliceShortOptionHandle(t *testing.T) { }, }, }).Run([]string{"run", "foobar", "--net=foo", "-it"}) + if err != nil { + t.Fatal(err) + } + if !wasCalled { + t.Fatal("Action callback was never called") + } }