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

Function TestMultipleConfigLoading

config_test.go:12–27  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestMultipleConfigLoading(t *testing.T) {
13 var cli struct {
14 Flag string `json:"flag,omitempty"`
15 }
16
17 cli.Flag = "first"
18 first := makeConfig(t, &cli)
19
20 cli.Flag = ""
21 second := makeConfig(t, &cli)
22
23 p := mustNew(t, &cli, kong.Configuration(kong.JSON, first, second))
24 _, err := p.Parse(nil)
25 assert.NoError(t, err)
26 assert.Equal(t, "first", cli.Flag)
27}
28
29func TestConfigValidation(t *testing.T) {
30 var cli struct {

Callers

nothing calls this directly

Calls 4

ConfigurationFunction · 0.92
makeConfigFunction · 0.85
mustNewFunction · 0.85
ParseMethod · 0.45

Tested by

no test coverage detected