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

Function TestBoolFlagValueFromCommand

flag_test.go:71–86  ·  flag_test.go::TestBoolFlagValueFromCommand
(t *testing.T)

Source from the content-addressed store, hash-verified

69}
70
71func TestBoolFlagValueFromCommand(t *testing.T) {
72 tf := &BoolFlag{Name: "trueflag"}
73 ff := &BoolFlag{Name: "falseflag"}
74
75 cmd := buildMinimalTestCommand()
76 cmd.Flags = []Flag{
77 tf,
78 ff,
79 }
80
81 r := require.New(t)
82 r.NoError(cmd.Set(tf.Name, "true"))
83 r.NoError(cmd.Set(ff.Name, "false"))
84 r.True(cmd.Bool(tf.Name))
85 r.False(cmd.Bool(ff.Name))
86}
87
88func TestBoolFlagApply_SetsCount(t *testing.T) {
89 v := false

Callers

nothing calls this directly

Calls 3

buildMinimalTestCommandFunction · 0.85
BoolMethod · 0.80
SetMethod · 0.65

Tested by

no test coverage detected