-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathcontext_test.go
More file actions
40 lines (34 loc) · 751 Bytes
/
context_test.go
File metadata and controls
40 lines (34 loc) · 751 Bytes
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
package mux
import (
"net/http"
"net/url"
"testing"
)
func TestGetQueriesFail(t *testing.T) {
r := new(http.Request)
if value := GetQueries(r); value != nil {
t.Errorf("Unexpected value (%v)", value)
}
}
func TestCurrentRouteFail(t *testing.T) {
r := new(http.Request)
if value := CurrentRoute(r); value != nil {
t.Errorf("Unexpected value (%v)", value)
}
}
func TestGetVarsFail(t *testing.T) {
r := new(http.Request)
if value := GetVars(r); value != nil {
t.Errorf("Unexpected value (%v)", value)
}
}
func BenchmarkExtractQueries(b *testing.B) {
request := &http.Request{
URL: &url.URL{
RawQuery: "limit=10&offset=10&gender=female&age[0]=20&age[0]=50",
},
}
for n := 0; n < b.N; n++ {
extractQueries(request)
}
}