Merge from main

This commit is contained in:
Naveen Gogineni 2022-08-31 08:25:29 -04:00
parent 0c7dcf7c2b
commit f6b4ee0e78
2 changed files with 10 additions and 10 deletions

View File

@ -40,7 +40,7 @@ func (ris *racyInputSource) isSet(name string) bool {
func TestGenericApplyInputSourceValue_Alias(t *testing.T) { func TestGenericApplyInputSourceValue_Alias(t *testing.T) {
v := &Parser{"abc", "def"} v := &Parser{"abc", "def"}
tis := testApplyInputSource{ tis := testApplyInputSource{
Flag: NewGenericFlag(&cli.GenericFlag{Name: "test", Aliases: []string{"test_alias"}, Value: &Parser{}}), Flag: NewGenericFlag(&cli.GenericFlag{Name: "test", Aliases: []string{"test_alias"}, Value: &Parser{}}),
FlagName: "test_alias", FlagName: "test_alias",
MapValue: v, MapValue: v,
} }

View File

@ -2693,55 +2693,55 @@ func TestFlagDefaultValue(t *testing.T) {
name: "stringSlice", name: "stringSlice",
flag: &StringSliceFlag{Name: "flag", Value: NewStringSlice("default1", "default2")}, flag: &StringSliceFlag{Name: "flag", Value: NewStringSlice("default1", "default2")},
toParse: []string{"--flag", "parsed"}, toParse: []string{"--flag", "parsed"},
expect: `--flag value [ --flag value ] (default: "default1", "default2")`, expect: `--flag value [ --flag value ] (default: "default1", "default2")`,
}, },
{ {
name: "float64Slice", name: "float64Slice",
flag: &Float64SliceFlag{Name: "flag", Value: NewFloat64Slice(1.1, 2.2)}, flag: &Float64SliceFlag{Name: "flag", Value: NewFloat64Slice(1.1, 2.2)},
toParse: []string{"--flag", "13.3"}, toParse: []string{"--flag", "13.3"},
expect: `--flag value [ --flag value ] (default: 1.1, 2.2)`, expect: `--flag value [ --flag value ] (default: 1.1, 2.2)`,
}, },
{ {
name: "int64Slice", name: "int64Slice",
flag: &Int64SliceFlag{Name: "flag", Value: NewInt64Slice(1, 2)}, flag: &Int64SliceFlag{Name: "flag", Value: NewInt64Slice(1, 2)},
toParse: []string{"--flag", "13"}, toParse: []string{"--flag", "13"},
expect: `--flag value [ --flag value ] (default: 1, 2)`, expect: `--flag value [ --flag value ] (default: 1, 2)`,
}, },
{ {
name: "intSlice", name: "intSlice",
flag: &IntSliceFlag{Name: "flag", Value: NewIntSlice(1, 2)}, flag: &IntSliceFlag{Name: "flag", Value: NewIntSlice(1, 2)},
toParse: []string{"--flag", "13"}, toParse: []string{"--flag", "13"},
expect: `--flag value [ --flag value ] (default: 1, 2)`, expect: `--flag value [ --flag value ] (default: 1, 2)`,
}, },
{ {
name: "uint64Slice", name: "uint64Slice",
flag: &Uint64SliceFlag{Name: "flag", Value: NewUint64Slice(1, 2)}, flag: &Uint64SliceFlag{Name: "flag", Value: NewUint64Slice(1, 2)},
toParse: []string{"--flag", "13"}, toParse: []string{"--flag", "13"},
expect: `--flag value [ --flag value ] (default: 1, 2)`, expect: `--flag value [ --flag value ] (default: 1, 2)`,
}, },
{ {
name: "uintSlice", name: "uintSlice",
flag: &UintSliceFlag{Name: "flag", Value: NewUintSlice(1, 2)}, flag: &UintSliceFlag{Name: "flag", Value: NewUintSlice(1, 2)},
toParse: []string{"--flag", "13"}, toParse: []string{"--flag", "13"},
expect: `--flag value [ --flag value ] (default: 1, 2)`, expect: `--flag value [ --flag value ] (default: 1, 2)`,
}, },
{ {
name: "string", name: "string",
flag: &StringFlag{Name: "flag", Value: "default"}, flag: &StringFlag{Name: "flag", Value: "default"},
toParse: []string{"--flag", "parsed"}, toParse: []string{"--flag", "parsed"},
expect: `--flag value (default: "default")`, expect: `--flag value (default: "default")`,
}, },
{ {
name: "bool", name: "bool",
flag: &BoolFlag{Name: "flag", Value: true}, flag: &BoolFlag{Name: "flag", Value: true},
toParse: []string{"--flag", "false"}, toParse: []string{"--flag", "false"},
expect: `--flag (default: true)`, expect: `--flag (default: true)`,
}, },
{ {
name: "uint64", name: "uint64",
flag: &Uint64Flag{Name: "flag", Value: 1}, flag: &Uint64Flag{Name: "flag", Value: 1},
toParse: []string{"--flag", "13"}, toParse: []string{"--flag", "13"},
expect: `--flag value (default: 1)`, expect: `--flag value (default: 1)`,
}, },
} }
for i, v := range cases { for i, v := range cases {