diff --git a/flag_test.go b/flag_test.go index 7d7a80b359..bc01a5a205 100644 --- a/flag_test.go +++ b/flag_test.go @@ -2375,6 +2375,22 @@ func TestParseMultiBoolT(t *testing.T) { }).Run(buildTestContext(t), []string{"run", "--implode=false"}) } +func TestStringSliceFlagApply_LocalPreservesRepeatedValues(t *testing.T) { + var got []string + cmd := &Command{ + Flags: []Flag{ + &StringSliceFlag{Name: "values", Local: true}, + }, + Action: func(_ context.Context, cmd *Command) error { + got = cmd.StringSlice("values") + return nil + }, + } + + require.NoError(t, cmd.Run(buildTestContext(t), []string{"run", "--values", "a,b,c", "--values", "d", "--values", "e"})) + require.Equal(t, []string{"a", "b", "c", "d", "e"}, got) +} + func TestStringSlice_Serialized_Set(t *testing.T) { sl0 := NewStringSlice("a", "b") ser0 := sl0.Serialize()