MCPcopy Create free account
hub / github.com/alecthomas/kong / TestBoolPtrFalse

Function TestBoolPtrFalse

kong_test.go:2470–2482  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2468}
2469
2470func TestBoolPtrFalse(t *testing.T) {
2471 var cli struct {
2472 X *bool
2473 }
2474 k, err := kong.New(&cli)
2475 assert.NoError(t, err)
2476 assert.NotZero(t, k)
2477 ctx, err := k.Parse([]string{"--x=false"})
2478 assert.NoError(t, err)
2479 assert.NotZero(t, ctx)
2480 assert.NotZero(t, cli.X)
2481 assert.Equal(t, false, *cli.X)
2482}
2483
2484func TestBoolPtrNegated(t *testing.T) {
2485 var cli struct {

Callers

nothing calls this directly

Calls 2

NewFunction · 0.92
ParseMethod · 0.45

Tested by

no test coverage detected