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

Function TestParseBoolShortOptionHandle

flag_test.go:2273–2291  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2271}
2272
2273func TestParseBoolShortOptionHandle(t *testing.T) {
2274 _ = (&Command{
2275 Commands: []*Command{
2276 {
2277 Name: "foobar",
2278 UseShortOptionHandling: true,
2279 Action: func(_ context.Context, cmd *Command) error {
2280 assert.True(t, cmd.Bool("serve"), "main name not set")
2281 assert.True(t, cmd.Bool("option"), "short name not set")
2282 return nil
2283 },
2284 Flags: []Flag{
2285 &BoolFlag{Name: "serve", Aliases: []string{"s"}},
2286 &BoolFlag{Name: "option", Aliases: []string{"o"}},
2287 },
2288 },
2289 },
2290 }).Run(buildTestContext(t), []string{"run", "foobar", "-so"})
2291}
2292
2293func TestParseDestinationBool(t *testing.T) {
2294 var dest bool

Callers

nothing calls this directly

Calls 3

buildTestContextFunction · 0.85
BoolMethod · 0.80
RunMethod · 0.45

Tested by

no test coverage detected