Fix struct input test in jsonpath

pull/6/head
Daniel Martí 2015-08-21 14:15:09 -07:00
parent 1313e3b14e
commit 5f3aff2c43
2 changed files with 2 additions and 2 deletions

View File

@ -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 {

View File

@ -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, "<map[string]int Value> 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"},
}