} storeTests := []jsonpathTest{ <del> {"plain", "hello jsonpath", nil, "hello jsonpath"}, {"recursive", "{..}", []int{1, 2, 3}, "[1 2 3]"}, {"filter", "{[?(@<5)]}", []int{2, 6, 3, 7}, "2 3"}, {"quote", `{"{"}`, nil, "{"}, {"union", "{[1,3,4]}", []int{0, 1, 2, 3, 4}, "1 3 4"}, {"array", "{[0:2]}", []string{"Monday", "Tudesday"}, "Monday Tudesday"}, {"variable", "hello {.Name}", storeData, "hello jsonpath"}, {"dict/", "{$.Labels.web/html}", storeData, "15"}, {"dict/", "{$.Employees.jason}", storeData, "manager"}, {"dict/", "{$.Employees.dan}", storeData, "clerk"}, {"dict-", "{.Labels.k8s-app}", storeData, "20"}, {"nest", "{.Bicycle[*].Color}", storeData, "red green"}, {"allarray", "{.Book[*].Author}", storeData, "Nigel Rees Evelyn Waugh Herman Melville"}, {"allfileds", "{.Bicycle.*}", storeData, "{red 19.95 true} {green 20.01 false}"}, {"recurfileds", "{..Price}", storeData, "8.95 12.99 8.99 19.95 20.01"}, </del> <ins> {"plain", "hello jsonpath", nil, "hello jsonpath", false}, {"recursive", "{..}", []int{1, 2, 3}, "[1 2 3]", false}, {"filter", "{[?(@<5)]}", []int{2, 6, 3, 7}, "2 3", false}, {"quote", `{"{"}`, nil, "{", false}, {"union", "{[1,3,4]}", []int{0, 1, 2, 3, 4}, "1 3 4", false}, {"array", "{[0:2]}", []string{"Monday", "Tudesday"}, "Monday Tudesday", false}, {"variable", "hello {.Name}", storeData, "hello jsonpath", false}, {"dict/", "{$.Labels.web/html}", storeData, "15", false}, {"dict/", "{$.Employees.jason}", storeData, "manager", false}, {"dict/", "{$.Employees.dan}", storeData, "clerk", false}, {"dict-", "{.Labels.k8s-app}", storeData, "20", false}, {"nest", "{.Bicycle[*].Color}", storeData, "red green", false}, {"allarray", "{.Book[*].Author}", storeData, "Nigel Rees Evelyn Waugh Herman Melville", false}, {"allfileds", "{.Bicycle.*}", storeData, "{red 19.95 true} {green 20.01 false}", false}, {"recurfileds", "{..Price}", storeData, "8.95 12.99 8.99 19.95 20.01", false}, </ins> {"lastarray", "{.Book[-1:]}", storeData, <del> "{Category: fiction, Author: Herman Melville, Title: Moby Dick, Price: 8.99}"}, </del> <ins> "{Category: fiction, Author: Herman Melville, Title: Moby Dick, Price: 8.99}", false}, </ins> {"recurarray", "{..Book[2]}", storeData, <del> "{Category: fiction, Author: Herman Melville, Title: Moby Dick, Price: 8.99}"}, {"bool", "{.Bicycle[?(@.IsNew==true)]}", storeData, "{red 19.95 true}"}, </del> <ins> "{Category: fiction, Author: Herman Melville, Title: Moby Dick, Price: 8.99}", false}, {"bool", "{.Bicycle[?(@.IsNew==true)]}", storeData, "{red 19.95 true}", false}, </ins> } testJSONPath(storeTests, false, t) missingKeyTests := []jsonpathTest{ <del> {"nonexistent field", "{.hello}", storeData, ""}, </del> <ins> {"nonexistent field", "{.hello}", storeData, "", false}, </ins> } testJSONPath(missingKeyTests, true, t) failStoreTests := []jsonpathTest{ <del> {"invalid identifier", "{hello}", storeData, "unrecognized identifier hello"}, {"nonexistent field", "{.hello}", storeData, "hello is not found"}, {"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"}, </del> <ins> {"invalid identifier", "{hello}", storeData, "unrecognized identifier hello", false}, {"nonexistent field", "{.hello}", storeData, "hello is not found", false}, {"invalid array", "{.Labels[0]}", storeData, "map[string]int is not array or slice", false}, {"invalid filter operator", "{.Book[?(@.Price<>10)]}", storeData, "unrecognized filter operator <>", false}, {"redundent end", "{range .Labels.*}{@}{end}{end}", storeData, "not in range, nothing to end", false}, </ins> } testFailJSONPath(failStoreTests, t) }