package query import "testing" func TestMarshal(t *testing.T) { q := struct { A string `query:"x"` B int C string `query:",optional"` D []byte }{ A: "test", B: 100, D: []byte{1, 2, 3}, } v, err := Marshal(q) if err != nil { t.Error(err) } if v != "?b=100&d=%01%02%03&x=test" { t.Error("wrong result", v) } }