aboutsummaryrefslogtreecommitdiff
path: root/query/query_test.go
blob: 84d5ab1a0cf5e5ecb1986ceea524c660429eec7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package query

import "testing"

func TestMarshal(t *testing.T) {
	q := struct {
		A string `query:"x"`
		B int
		C string `query:",optional"`
		D [3]byte
	}{
		A: "test",
		B: 100,
		D: [3]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)
	}

}