func TestGet(t *testing.T) { is := is.New(t) for _, test := range getTests { actual, ok := m.GetOK(test.M, test.K) is.Equal(actual, test.V) is.Equal(ok, test.OK) } }
func (r *Runner) assertData(data interface{}, errData error, key string, expected *parse.Value) bool { if errData != nil { r.log(key, fmt.Sprintf("expected %s: %s actual: failed to parse body: %s", expected.Type(), expected, errData)) return false } if data == nil { r.log(key, fmt.Sprintf("expected %s: %s actual: no data", expected.Type(), expected)) return false } actual, ok := m.GetOK(map[string]interface{}{"Data": data}, key) if !ok && expected.Data != nil { r.log(key, fmt.Sprintf("expected %s: %s actual: (missing)", expected.Type(), expected)) return false } if !ok && expected.Data == nil { return true } if !expected.Equal(actual) { actualVal := parse.ParseValue([]byte(fmt.Sprintf("%v", actual))) r.log(key, fmt.Sprintf("expected %s: %s actual %T: %s", expected.Type(), expected, actual, actualVal)) return false } return true }