-
Notifications
You must be signed in to change notification settings - Fork 13
/
fedbox_test.go
49 lines (47 loc) · 1.01 KB
/
fedbox_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package brutalinks
import (
"net/url"
"testing"
)
func Test_RawFilterQuery(t *testing.T) {
{
var func1 = func() url.Values {
return nil
}
mustBeEmpty := rawFilterQuery(func1)
testVal := ""
if mustBeEmpty != testVal {
t.Errorf("Value must be %q, received %q", testVal, mustBeEmpty)
}
}
{
var func1 = func() url.Values {
return url.Values{
"iri": {"ana", "are", "mere"},
}
}
testVal := "?iri=ana&iri=are&iri=mere"
anaAreMere := rawFilterQuery(func1)
if anaAreMere != testVal {
t.Errorf("Value must be %q string, received %q", testVal, anaAreMere)
}
}
{
var func1 = func() url.Values {
return url.Values{
"iri": {"ana", "are", "mere"},
}
}
var func2 = func() url.Values {
return url.Values{
"iri": {"foo", "bar"},
"type": {"typ"},
}
}
testVal := "?iri=ana&iri=are&iri=mere&iri=foo&iri=bar&type=typ"
anaAreMere := rawFilterQuery(func1, func2)
if anaAreMere != testVal {
t.Errorf("Value must be %q, received %q", testVal, anaAreMere)
}
}
}