Ejemplo n.º 1
0
func TestLoader_LoadString_keySuffix(t *testing.T) {
	in := `{
		"a": { "b": "b" },
		"c": { "d": "d" }
	}`
	l := &Loader{
		KeySuffix: config.NewKey("d"),
	}
	want := config.NewValues()
	want.Put(config.NewKey("c", "d"), "d")

	testLoadStringWithWantedValues(t, l, in, want)
}
Ejemplo n.º 2
0
func TestLoader_Load(t *testing.T) {
	l := New("")
	l.FlagSet.String("a", "", "")
	l.Args = []string{"-a", "value"}

	want := config.NewValues()
	want.Put(config.NewKey("a"), "value")

	testLoadWithWantedValues(t, l, want)
}
Ejemplo n.º 3
0
func TestLoader_LoadString_numberAsString(t *testing.T) {
	in := `{
		"a": 12
	}`
	l := &Loader{
		NumberAsString: true,
	}
	want := config.NewValues()
	want.Put(config.NewKey("a"), "12")

	testLoadStringWithWantedValues(t, l, in, want)
}