alter BuildQuery to handle slices
diff --git a/params_test.go b/params_test.go
index f314a9e..2f40eec 100644
--- a/params_test.go
+++ b/params_test.go
@@ -34,18 +34,23 @@
}
func TestBuildQueryString(t *testing.T) {
+ type testVar string
opts := struct {
- J int `q:"j"`
- R string `q:"r,required"`
- C bool `q:"c"`
- S []string `q:"s"`
+ J int `q:"j"`
+ R string `q:"r,required"`
+ C bool `q:"c"`
+ S []string `q:"s"`
+ TS []testVar `q:"ts"`
+ TI []int `q:"ti"`
}{
- J: 2,
- R: "red",
- C: true,
- S: []string{"one", "two", "three"},
+ J: 2,
+ R: "red",
+ C: true,
+ S: []string{"one", "two", "three"},
+ TS: []testVar{"a", "b"},
+ TI: []int{1, 2},
}
- expected := &url.URL{RawQuery: "c=true&j=2&r=red&s=one&s=two&s=three"}
+ expected := &url.URL{RawQuery: "c=true&j=2&r=red&s=one&s=two&s=three&ti=1&ti=2&ts=a&ts=b"}
actual, err := BuildQueryString(&opts)
if err != nil {
t.Errorf("Error building query string: %v", err)
@@ -53,10 +58,12 @@
th.CheckDeepEquals(t, expected, actual)
opts = struct {
- J int `q:"j"`
- R string `q:"r,required"`
- C bool `q:"c"`
- S []string `q:"s"`
+ J int `q:"j"`
+ R string `q:"r,required"`
+ C bool `q:"c"`
+ S []string `q:"s"`
+ TS []testVar `q:"ts"`
+ TI []int `q:"ti"`
}{
J: 2,
C: true,