MCPcopy
hub / github.com/urfave/cli / TestStringSliceFlagApply_LocalPreservesRepeatedValues

Function TestStringSliceFlagApply_LocalPreservesRepeatedValues

flag_test.go:2378–2392  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2376}
2377
2378func TestStringSliceFlagApply_LocalPreservesRepeatedValues(t *testing.T) {
2379 var got []string
2380 cmd := &Command{
2381 Flags: []Flag{
2382 &StringSliceFlag{Name: "values", Local: true},
2383 },
2384 Action: func(_ context.Context, cmd *Command) error {
2385 got = cmd.StringSlice("values")
2386 return nil
2387 },
2388 }
2389
2390 require.NoError(t, cmd.Run(buildTestContext(t), []string{"run", "--values", "a,b,c", "--values", "d", "--values", "e"}))
2391 require.Equal(t, []string{"a", "b", "c", "d", "e"}, got)
2392}
2393
2394func TestStringSlice_Serialized_Set(t *testing.T) {
2395 sl0 := NewStringSlice("a", "b")

Callers

nothing calls this directly

Calls 3

StringSliceMethod · 0.95
RunMethod · 0.95
buildTestContextFunction · 0.85

Tested by

no test coverage detected