MCPcopy Create free account
hub / github.com/felixge/httpsnoop / TestWrap

Function TestWrap

wrap_generated_test.go:11–26380  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

9)
10
11func TestWrap(t *testing.T) {
12 // combination 1/512
13 {
14 t.Log("http.ResponseWriter")
15 inner := struct {
16 http.ResponseWriter
17 }{}
18 w := Wrap(inner, Hooks{})
19 if _, ok := w.(http.ResponseWriter); ok != true {
20 t.Error("unexpected interface")
21 }
22 if _, ok := w.(http.Flusher); ok != false {
23 t.Error("unexpected interface")
24 }
25 if _, ok := w.(httpFlushError); ok != false {
26 t.Error("unexpected interface")
27 }
28 if _, ok := w.(http.CloseNotifier); ok != false {
29 t.Error("unexpected interface")
30 }
31 if _, ok := w.(http.Hijacker); ok != false {
32 t.Error("unexpected interface")
33 }
34 if _, ok := w.(io.ReaderFrom); ok != false {
35 t.Error("unexpected interface")
36 }
37 if _, ok := w.(deadliner); ok != false {
38 t.Error("unexpected interface")
39 }
40 if _, ok := w.(fullDuplexEnabler); ok != false {
41 t.Error("unexpected interface")
42 }
43 if _, ok := w.(http.Pusher); ok != false {
44 t.Error("unexpected interface")
45 }
46 if _, ok := w.(io.StringWriter); ok != false {
47 t.Error("unexpected interface")
48 }
49
50 if w, ok := w.(Unwrapper); ok {
51 if w.Unwrap() != inner {
52 t.Error("w.Unwrap() failed")
53 }
54 } else {
55 t.Error("Unwrapper interface not implemented")
56 }
57 }
58
59 // combination 2/512
60 {
61 t.Log("http.ResponseWriter, io.StringWriter")
62 inner := struct {
63 http.ResponseWriter
64 io.StringWriter
65 }{}
66 w := Wrap(inner, Hooks{})
67 if _, ok := w.(http.ResponseWriter); ok != true {
68 t.Error("unexpected interface")

Callers

nothing calls this directly

Calls 2

WrapFunction · 0.85
UnwrapMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…