aboutsummaryrefslogtreecommitdiffstats
path: root/client/go/cmd/query_test.go
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2022-06-08 09:53:24 +0200
committerMartin Polden <mpolden@mpolden.no>2022-06-08 09:59:39 +0200
commit762a514a2498bdc30db424a4dd712f2c409b33b1 (patch)
tree9a2a7ee57a8d611d682fef8911bb9627d83ba65b /client/go/cmd/query_test.go
parent3c11b757e61d022832de4c48fae6f0a44030f4bd (diff)
Handle bare query containing equals
Diffstat (limited to 'client/go/cmd/query_test.go')
-rw-r--r--client/go/cmd/query_test.go16
1 files changed, 14 insertions, 2 deletions
diff --git a/client/go/cmd/query_test.go b/client/go/cmd/query_test.go
index ab03058d079..d024ca5189e 100644
--- a/client/go/cmd/query_test.go
+++ b/client/go/cmd/query_test.go
@@ -39,8 +39,20 @@ func TestQueryNonJsonResult(t *testing.T) {
func TestQueryWithMultipleParameters(t *testing.T) {
assertQuery(t,
- "?hits=5&timeout=20s&yql=select+from+sources+%2A+where+title+contains+%27foo%27",
- "select from sources * where title contains 'foo'", "hits=5", "timeout=20s")
+ "?hits=5&timeout=20s&yql=select+from+sources+%2A+where+title+contains+%27foo%27+and+year+%3D+2000",
+ "select from sources * where title contains 'foo' and year = 2000", "hits=5", "timeout=20s")
+}
+
+func TestQueryWithEquals(t *testing.T) {
+ assertQuery(t,
+ "?timeout=10s&yql=SELECT+from+sources+%2A+where+title+contains+%27foo%27+and+year+%3D+2000",
+ "SELECT from sources * where title contains 'foo' and year = 2000")
+}
+
+func TestQuerySelect(t *testing.T) {
+ assertQuery(t,
+ "?hits=5&select=%7B%22select%22%3A%7B%22where%22%3A%7B%22contains%22%3A%5B%22title%22%2C%22a%22%5D%7D%7D%7D&timeout=10s",
+ `select={"select":{"where":{"contains":["title","a"]}}}`, "hits=5")
}
func TestQueryWithExplicitYqlParameter(t *testing.T) {