MCPcopy
hub / github.com/spf13/viper / TestAliasInConfigFile

Function TestAliasInConfigFile

viper_test.go:532–545  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

530}
531
532func TestAliasInConfigFile(t *testing.T) {
533 v := New()
534
535 v.SetConfigType("yaml")
536
537 // Read the YAML data into Viper configuration
538 require.NoError(t, v.ReadConfig(bytes.NewBuffer(yamlExample)), "Error reading YAML data")
539
540 v.RegisterAlias("beard", "hasbeard")
541 assert.Equal(t, true, v.Get("hasbeard"))
542
543 v.Set("hasbeard", false)
544 assert.Equal(t, false, v.Get("beard"))
545}
546
547func TestYML(t *testing.T) {
548 v := New()

Callers

nothing calls this directly

Calls 6

NewFunction · 0.85
SetConfigTypeMethod · 0.80
ReadConfigMethod · 0.80
RegisterAliasMethod · 0.80
GetMethod · 0.65
SetMethod · 0.45

Tested by

no test coverage detected