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
|
package httpsnoop
import (
"net/http/httptest"
"testing"
)
func TestUnwrap(t *testing.T) {
w := Wrap(httptest.NewRecorder(), Hooks{})
if _, ok := Unwrap(w).(*httptest.ResponseRecorder); !ok {
t.Error("expected ResponseRecorder")
}
}
func TestUnwrapWithoutWrap(t *testing.T) {
w := httptest.NewRecorder()
if _, ok := Unwrap(w).(*httptest.ResponseRecorder); !ok {
t.Error("expected ResponseRecorder")
}
}
func TestUnwrapMultipleLayers(t *testing.T) {
w := Wrap(Wrap(httptest.NewRecorder(), Hooks{}), Hooks{})
if _, ok := Unwrap(w).(*httptest.ResponseRecorder); !ok {
t.Error("expected ResponseRecorder")
}
}
|