File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -33,8 +33,6 @@ import (
33
33
"golang.org/x/net/http/httpguts"
34
34
)
35
35
36
- // TODO(jba): test
37
-
38
36
// Errors used by the HTTP server.
39
37
var (
40
38
// ErrBodyNotAllowed is returned by ResponseWriter.Write calls
Original file line number Diff line number Diff line change @@ -118,6 +118,20 @@ func TestFindHandler(t *testing.T) {
118
118
}
119
119
}
120
120
121
+ func TestEmptyServeMux (t * testing.T ) {
122
+ // Verify that a ServeMux with nothing registered
123
+ // doesn't panic.
124
+ mux := NewServeMux ()
125
+ var r Request
126
+ r .Method = "GET"
127
+ r .Host = "example.com"
128
+ r .URL = & url.URL {Path : "/" }
129
+ _ , p := mux .Handler (& r )
130
+ if p != "" {
131
+ t .Errorf (`got %q, want ""` , p )
132
+ }
133
+ }
134
+
121
135
func TestRegisterErr (t * testing.T ) {
122
136
mux := NewServeMux ()
123
137
h := & handler {}
You can’t perform that action at this time.
0 commit comments