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

Function Test_HelpFlag_RequiredFlagsNoDefault

help_test.go:111–137  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

109}
110
111func Test_HelpFlag_RequiredFlagsNoDefault(t *testing.T) {
112 output := new(bytes.Buffer)
113
114 cmd := &Command{
115 Flags: []Flag{
116 &Int64Flag{Name: "foo", Aliases: []string{"f"}, Required: true},
117 },
118 Arguments: AnyArguments,
119 Writer: output,
120 }
121
122 _ = cmd.Run(buildTestContext(t), []string{"test", "-h"})
123
124 expected := `NAME:
125 test - A new cli application
126
127USAGE:
128 test [global options] [arguments...]
129
130GLOBAL OPTIONS:
131 --foo int, -f int
132 --help, -h show help
133`
134
135 assert.Contains(t, output.String(), expected,
136 "expected output to include usage text")
137}
138
139func Test_HelpCommand_RequiredFlagsNoDefault(t *testing.T) {
140 output := new(bytes.Buffer)

Callers

nothing calls this directly

Calls 3

RunMethod · 0.95
buildTestContextFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected