func assertConfigsEqual(c1 types.Config, c2 types.Config, t *testing.T) bool { printConfig("c1", c1, t) t.Log("") printConfig("c2", c2, t) t.Log("") c1Keys := c1.AllKeys() c2Keys := c2.AllKeys() for _, k := range c1Keys { c1v := c1.Get(k) c2v := c2.Get(k) if !reflect.DeepEqual(c1v, c2v) { t.Logf("%s != in both configs; "+ "c1v:type=%[2]T,val=%[2]v; "+ "c2v:type=%[3]T,val=%[3]v", k, c1v, c2v) return false } } for _, k := range c2Keys { c1v := c1.Get(k) c2v := c2.Get(k) if !reflect.DeepEqual(c1v, c2v) { t.Logf("%s != in both configs; "+ "c1v:type=%[2]T,val=%[2]v; "+ "c2v:type=%[3]T,val=%[3]v", k, c1v, c2v) return false } } return true }
func printConfig(title string, c types.Config, t *testing.T) { for _, k := range c.AllKeys() { if title == "" { t.Logf("%s=%v", k, c.Get(k)) } else { t.Logf("%s - %s=%v", title, k, c.Get(k)) } } }
func printKeys(title string, c types.Config, t *testing.T) { for _, k := range c.AllKeys() { if title == "" { t.Logf(k) } else { t.Logf("%s - %s", title, k) } } }