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

Function TestParseMultiStringSliceWithDefaultsUnset

flag_test.go:1925–1937  ·  flag_test.go::TestParseMultiStringSliceWithDefaultsUnset
(t *testing.T)

Source from the content-addressed store, hash-verified

1923}
1924
1925func TestParseMultiStringSliceWithDefaultsUnset(t *testing.T) {
1926 _ = (&Command{
1927 Flags: []Flag{
1928 &StringSliceFlag{Name: "serve", Aliases: []string{"s"}, Value: []string{"9", "2"}},
1929 },
1930 Action: func(_ context.Context, cmd *Command) error {
1931 expected := []string{"9", "2"}
1932 assert.Equal(t, expected, cmd.StringSlice("serve"), "main name not set")
1933 assert.Equal(t, expected, cmd.StringSlice("s"), "short name not set")
1934 return nil
1935 },
1936 }).Run(buildTestContext(t), []string{"run"})
1937}
1938
1939func TestParseMultiStringSliceFromEnv(t *testing.T) {
1940 t.Setenv("APP_INTERVALS", "20,30,40")

Callers

nothing calls this directly

Calls 3

buildTestContextFunction · 0.85
StringSliceMethod · 0.80
RunMethod · 0.45

Tested by

no test coverage detected