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

Function TestMultipleCustomValueFormatter

help_test.go:538–553  ·  view source on GitHub ↗

nolint:dupl // false positive

(t *testing.T)

Source from the content-addressed store, hash-verified

536
537//nolint:dupl // false positive
538func TestMultipleCustomValueFormatter(t *testing.T) {
539 var cli struct {
540 Flag string `env:"FLAG1,FLAG2" help:"A flag."`
541 }
542 w := &strings.Builder{}
543 p := mustNew(t, &cli,
544 kong.Writers(w, w),
545 kong.Exit(func(int) {}),
546 kong.ValueFormatter(func(value *kong.Value) string {
547 return value.Help
548 }),
549 )
550 _, err := p.Parse([]string{"--help"})
551 assert.NoError(t, err)
552 assert.Contains(t, w.String(), "A flag.")
553}
554
555func TestAutoGroup(t *testing.T) {
556 var cli struct {

Callers

nothing calls this directly

Calls 6

WritersFunction · 0.92
ExitFunction · 0.92
ValueFormatterFunction · 0.92
mustNewFunction · 0.85
ParseMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected