diff options
Diffstat (limited to 'src/net/http/httptest/server_test.go')
| -rw-r--r-- | src/net/http/httptest/server_test.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/net/http/httptest/server_test.go b/src/net/http/httptest/server_test.go index 62846de02c..d97cec5fdd 100644 --- a/src/net/http/httptest/server_test.go +++ b/src/net/http/httptest/server_test.go @@ -145,3 +145,20 @@ func TestTLSServerClientTransportType(t *testing.T) { t.Errorf("got %T, want *http.Transport", client.Transport) } } + +type onlyCloseListener struct { + net.Listener +} + +func (onlyCloseListener) Close() error { return nil } + +// Issue 19729: panic in Server.Close for values created directly +// without a constructor (so the unexported client field is nil). +func TestServerZeroValueClose(t *testing.T) { + ts := &Server{ + Listener: onlyCloseListener{}, + Config: &http.Server{}, + } + + ts.Close() // tests that it doesn't panic +} |
