aboutsummaryrefslogtreecommitdiff
path: root/tracker/query_test.go
blob: bd9a174b595b27dccc6b0a667c9c7c6382b063bb (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 tracker

import "testing"

func TestMarshalQuery(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 := MarshalQuery(q)
	if err != nil {
		t.Error(err)
	}
	if v != "?b=100&d=%01%02%03&x=test" {
		t.Error("wrong result", v)
	}

}