func TestMultiRead(t *testing.T) { f, err := os.Open("test_config2.json") defer f.Close() if err != nil { panic(err) } err = config.ReadFile("other", f) if err != nil { panic(err) } cases := []struct { key string want interface{} }{ {"three", float64(3)}, {"four", "four"}, } for _, c := range cases { got := config.From("other").Get(c.key) if got != c.want { t.Errorf("config[%q] == %v, want %v", c.key, got, c.want) } } }
func init() { f, err := os.Open("test_config.json") defer f.Close() if err != nil { panic(err) } config.InitConfig() err = config.ReadFile("default", f) if err != nil { panic(err) } }