Skip to content

Commit 7ce34f6

Browse files
authored
Add colon support test
1 parent c0900c4 commit 7ce34f6

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

jsonpath_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,13 @@ func Test_jsonpath_JsonPathLookup_1(t *testing.T) {
9090
}
9191
}
9292

93+
// full array
94+
res, err = JsonPathLookup(json_data, "$.store.book[0:].price")
95+
t.Log(err, res)
96+
if res_v, ok := res.([]interface{}); ok != true || res_v[0].(float64) != 8.95 || res_v[1].(float64) != 12.99 || res_v[2].(float64) != 8.99 || res_v[3].(float64) != 22.99 {
97+
t.Errorf("exp: [8.95, 12.99, 8.99, 22.99], got: %v", res)
98+
}
99+
93100
// range
94101
res, err = JsonPathLookup(json_data, "$.store.book[0:1].price")
95102
t.Log(err, res)

0 commit comments

Comments
 (0)