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

Function TestFlagsByName

flag_test.go:3370–3395  ·  flag_test.go::TestFlagsByName
(t *testing.T)

Source from the content-addressed store, hash-verified

3368}
3369
3370func TestFlagsByName(t *testing.T) {
3371 flags := []Flag{
3372 &StringFlag{
3373 Name: "b2",
3374 },
3375 &Int64Flag{
3376 Name: "a0",
3377 },
3378 &FloatFlag{
3379 Name: "b1",
3380 },
3381 }
3382
3383 flagsByName := FlagsByName(flags)
3384 sort.Sort(flagsByName)
3385
3386 assert.Equal(t, len(flags), flagsByName.Len())
3387
3388 var prev Flag
3389 for _, f := range flags {
3390 if prev != nil {
3391 assert.LessOrEqual(t, prev.Names()[0], f.Names()[0])
3392 }
3393 prev = f
3394 }
3395}
3396
3397func TestNonStringMap(t *testing.T) {
3398 type (

Callers

nothing calls this directly

Calls 3

NamesMethod · 0.95
FlagsByNameTypeAlias · 0.85
LenMethod · 0.65

Tested by

no test coverage detected