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

Function TestExtFlag

flag_test.go:3308–3334  ·  flag_test.go::TestExtFlag
(t *testing.T)

Source from the content-addressed store, hash-verified

3306}
3307
3308func TestExtFlag(t *testing.T) {
3309 var iv intValue[int64]
3310 var ipv int64
3311
3312 f := &flag.Flag{
3313 Name: "bar",
3314 Usage: "bar usage",
3315 Value: iv.Create(11, &ipv, IntegerConfig{}),
3316 DefValue: "10",
3317 }
3318
3319 extF := &extFlag{
3320 f: f,
3321 }
3322
3323 assert.Equal(t, []string{"bar"}, extF.Names())
3324 assert.True(t, extF.IsVisible())
3325 assert.False(t, extF.IsSet())
3326 assert.False(t, extF.TakesValue())
3327 assert.Equal(t, "bar usage", extF.GetUsage())
3328 assert.Equal(t, "11", extF.GetValue())
3329 assert.Equal(t, "10", extF.GetDefaultText())
3330 assert.Nil(t, extF.GetEnvVars())
3331
3332 assert.Equal(t, "integer", extF.SchemaType())
3333 assert.Equal(t, "", extF.SchemaItemsType())
3334}
3335
3336func TestSliceValuesNil(t *testing.T) {
3337 assert.Equal(t, []float64(nil), NewFloatSlice().Value())

Callers

nothing calls this directly

Calls 11

NamesMethod · 0.95
IsVisibleMethod · 0.95
IsSetMethod · 0.95
TakesValueMethod · 0.95
GetUsageMethod · 0.95
GetValueMethod · 0.95
GetDefaultTextMethod · 0.95
GetEnvVarsMethod · 0.95
SchemaTypeMethod · 0.95
SchemaItemsTypeMethod · 0.95
CreateMethod · 0.65

Tested by

no test coverage detected