Skip to content

Commit

Permalink
Changes from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
dearchap committed Apr 23, 2022
1 parent dd70656 commit 8c5f1fb
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions flag_test.go
Expand Up @@ -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"}) {
Expand All @@ -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")
}
}

0 comments on commit 8c5f1fb

Please sign in to comment.