From 5f3aff2c43fe2ba7c3c88e8a51b2d53833f7bd34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Fri, 21 Aug 2015 14:15:09 -0700 Subject: [PATCH] Fix struct input test in jsonpath --- pkg/util/jsonpath/jsonpath.go | 2 +- pkg/util/jsonpath/jsonpath_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/util/jsonpath/jsonpath.go b/pkg/util/jsonpath/jsonpath.go index 817af6307e..7d4b762099 100644 --- a/pkg/util/jsonpath/jsonpath.go +++ b/pkg/util/jsonpath/jsonpath.go @@ -217,7 +217,7 @@ func (j *JSONPath) evalArray(input []reflect.Value, node *ArrayNode) ([]reflect. value, isNil := template.Indirect(value) if isNil || (value.Kind() != reflect.Array && value.Kind() != reflect.Slice) { - return input, fmt.Errorf("%v is not array or slice", value) + return input, fmt.Errorf("%v is not array or slice", value.Type()) } params := node.Params if !params[0].Known { diff --git a/pkg/util/jsonpath/jsonpath_test.go b/pkg/util/jsonpath/jsonpath_test.go index 9922a8fee2..6a79d9fdfc 100644 --- a/pkg/util/jsonpath/jsonpath_test.go +++ b/pkg/util/jsonpath/jsonpath_test.go @@ -162,7 +162,7 @@ func TestStructInput(t *testing.T) { failStoreTests := []jsonpathTest{ {"invalid identfier", "{hello}", storeData, "unrecongnized identifier hello"}, {"nonexistent field", "{.hello}", storeData, "hello is not found"}, - {"invalid array", "{.Labels[0]}", storeData, " is not array or slice"}, + {"invalid array", "{.Labels[0]}", storeData, "map[string]int is not array or slice"}, {"invalid filter operator", "{.Book[?(@.Price<>10)]}", storeData, "unrecognized filter operator <>"}, {"redundent end", "{range .Labels.*}{@}{end}{end}", storeData, "not in range, nothing to end"}, }