1
2
3
4 package httpsnoop
5
6 import (
7 "io"
8 "net/http"
9 "testing"
10 )
11
12 func TestWrap(t *testing.T) {
13
14 {
15 t.Log("http.ResponseWriter")
16 inner := struct {
17 http.ResponseWriter
18 }{}
19 w := Wrap(inner, Hooks{})
20 if _, ok := w.(http.ResponseWriter); ok != true {
21 t.Error("unexpected interface")
22 }
23 if _, ok := w.(http.Flusher); ok != false {
24 t.Error("unexpected interface")
25 }
26 if _, ok := w.(http.CloseNotifier); ok != false {
27 t.Error("unexpected interface")
28 }
29 if _, ok := w.(http.Hijacker); ok != false {
30 t.Error("unexpected interface")
31 }
32 if _, ok := w.(io.ReaderFrom); ok != false {
33 t.Error("unexpected interface")
34 }
35
36 if w, ok := w.(Unwrapper); ok {
37 if w.Unwrap() != inner {
38 t.Error("w.Unwrap() failed")
39 }
40 } else {
41 t.Error("Unwrapper interface not implemented")
42 }
43 }
44
45
46 {
47 t.Log("http.ResponseWriter, io.ReaderFrom")
48 inner := struct {
49 http.ResponseWriter
50 io.ReaderFrom
51 }{}
52 w := Wrap(inner, Hooks{})
53 if _, ok := w.(http.ResponseWriter); ok != true {
54 t.Error("unexpected interface")
55 }
56 if _, ok := w.(http.Flusher); ok != false {
57 t.Error("unexpected interface")
58 }
59 if _, ok := w.(http.CloseNotifier); ok != false {
60 t.Error("unexpected interface")
61 }
62 if _, ok := w.(http.Hijacker); ok != false {
63 t.Error("unexpected interface")
64 }
65 if _, ok := w.(io.ReaderFrom); ok != true {
66 t.Error("unexpected interface")
67 }
68
69 if w, ok := w.(Unwrapper); ok {
70 if w.Unwrap() != inner {
71 t.Error("w.Unwrap() failed")
72 }
73 } else {
74 t.Error("Unwrapper interface not implemented")
75 }
76 }
77
78
79 {
80 t.Log("http.ResponseWriter, http.Hijacker")
81 inner := struct {
82 http.ResponseWriter
83 http.Hijacker
84 }{}
85 w := Wrap(inner, Hooks{})
86 if _, ok := w.(http.ResponseWriter); ok != true {
87 t.Error("unexpected interface")
88 }
89 if _, ok := w.(http.Flusher); ok != false {
90 t.Error("unexpected interface")
91 }
92 if _, ok := w.(http.CloseNotifier); ok != false {
93 t.Error("unexpected interface")
94 }
95 if _, ok := w.(http.Hijacker); ok != true {
96 t.Error("unexpected interface")
97 }
98 if _, ok := w.(io.ReaderFrom); ok != false {
99 t.Error("unexpected interface")
100 }
101
102 if w, ok := w.(Unwrapper); ok {
103 if w.Unwrap() != inner {
104 t.Error("w.Unwrap() failed")
105 }
106 } else {
107 t.Error("Unwrapper interface not implemented")
108 }
109 }
110
111
112 {
113 t.Log("http.ResponseWriter, http.Hijacker, io.ReaderFrom")
114 inner := struct {
115 http.ResponseWriter
116 http.Hijacker
117 io.ReaderFrom
118 }{}
119 w := Wrap(inner, Hooks{})
120 if _, ok := w.(http.ResponseWriter); ok != true {
121 t.Error("unexpected interface")
122 }
123 if _, ok := w.(http.Flusher); ok != false {
124 t.Error("unexpected interface")
125 }
126 if _, ok := w.(http.CloseNotifier); ok != false {
127 t.Error("unexpected interface")
128 }
129 if _, ok := w.(http.Hijacker); ok != true {
130 t.Error("unexpected interface")
131 }
132 if _, ok := w.(io.ReaderFrom); ok != true {
133 t.Error("unexpected interface")
134 }
135
136 if w, ok := w.(Unwrapper); ok {
137 if w.Unwrap() != inner {
138 t.Error("w.Unwrap() failed")
139 }
140 } else {
141 t.Error("Unwrapper interface not implemented")
142 }
143 }
144
145
146 {
147 t.Log("http.ResponseWriter, http.CloseNotifier")
148 inner := struct {
149 http.ResponseWriter
150 http.CloseNotifier
151 }{}
152 w := Wrap(inner, Hooks{})
153 if _, ok := w.(http.ResponseWriter); ok != true {
154 t.Error("unexpected interface")
155 }
156 if _, ok := w.(http.Flusher); ok != false {
157 t.Error("unexpected interface")
158 }
159 if _, ok := w.(http.CloseNotifier); ok != true {
160 t.Error("unexpected interface")
161 }
162 if _, ok := w.(http.Hijacker); ok != false {
163 t.Error("unexpected interface")
164 }
165 if _, ok := w.(io.ReaderFrom); ok != false {
166 t.Error("unexpected interface")
167 }
168
169 if w, ok := w.(Unwrapper); ok {
170 if w.Unwrap() != inner {
171 t.Error("w.Unwrap() failed")
172 }
173 } else {
174 t.Error("Unwrapper interface not implemented")
175 }
176 }
177
178
179 {
180 t.Log("http.ResponseWriter, http.CloseNotifier, io.ReaderFrom")
181 inner := struct {
182 http.ResponseWriter
183 http.CloseNotifier
184 io.ReaderFrom
185 }{}
186 w := Wrap(inner, Hooks{})
187 if _, ok := w.(http.ResponseWriter); ok != true {
188 t.Error("unexpected interface")
189 }
190 if _, ok := w.(http.Flusher); ok != false {
191 t.Error("unexpected interface")
192 }
193 if _, ok := w.(http.CloseNotifier); ok != true {
194 t.Error("unexpected interface")
195 }
196 if _, ok := w.(http.Hijacker); ok != false {
197 t.Error("unexpected interface")
198 }
199 if _, ok := w.(io.ReaderFrom); ok != true {
200 t.Error("unexpected interface")
201 }
202
203 if w, ok := w.(Unwrapper); ok {
204 if w.Unwrap() != inner {
205 t.Error("w.Unwrap() failed")
206 }
207 } else {
208 t.Error("Unwrapper interface not implemented")
209 }
210 }
211
212
213 {
214 t.Log("http.ResponseWriter, http.CloseNotifier, http.Hijacker")
215 inner := struct {
216 http.ResponseWriter
217 http.CloseNotifier
218 http.Hijacker
219 }{}
220 w := Wrap(inner, Hooks{})
221 if _, ok := w.(http.ResponseWriter); ok != true {
222 t.Error("unexpected interface")
223 }
224 if _, ok := w.(http.Flusher); ok != false {
225 t.Error("unexpected interface")
226 }
227 if _, ok := w.(http.CloseNotifier); ok != true {
228 t.Error("unexpected interface")
229 }
230 if _, ok := w.(http.Hijacker); ok != true {
231 t.Error("unexpected interface")
232 }
233 if _, ok := w.(io.ReaderFrom); ok != false {
234 t.Error("unexpected interface")
235 }
236
237 if w, ok := w.(Unwrapper); ok {
238 if w.Unwrap() != inner {
239 t.Error("w.Unwrap() failed")
240 }
241 } else {
242 t.Error("Unwrapper interface not implemented")
243 }
244 }
245
246
247 {
248 t.Log("http.ResponseWriter, http.CloseNotifier, http.Hijacker, io.ReaderFrom")
249 inner := struct {
250 http.ResponseWriter
251 http.CloseNotifier
252 http.Hijacker
253 io.ReaderFrom
254 }{}
255 w := Wrap(inner, Hooks{})
256 if _, ok := w.(http.ResponseWriter); ok != true {
257 t.Error("unexpected interface")
258 }
259 if _, ok := w.(http.Flusher); ok != false {
260 t.Error("unexpected interface")
261 }
262 if _, ok := w.(http.CloseNotifier); ok != true {
263 t.Error("unexpected interface")
264 }
265 if _, ok := w.(http.Hijacker); ok != true {
266 t.Error("unexpected interface")
267 }
268 if _, ok := w.(io.ReaderFrom); ok != true {
269 t.Error("unexpected interface")
270 }
271
272 if w, ok := w.(Unwrapper); ok {
273 if w.Unwrap() != inner {
274 t.Error("w.Unwrap() failed")
275 }
276 } else {
277 t.Error("Unwrapper interface not implemented")
278 }
279 }
280
281
282 {
283 t.Log("http.ResponseWriter, http.Flusher")
284 inner := struct {
285 http.ResponseWriter
286 http.Flusher
287 }{}
288 w := Wrap(inner, Hooks{})
289 if _, ok := w.(http.ResponseWriter); ok != true {
290 t.Error("unexpected interface")
291 }
292 if _, ok := w.(http.Flusher); ok != true {
293 t.Error("unexpected interface")
294 }
295 if _, ok := w.(http.CloseNotifier); ok != false {
296 t.Error("unexpected interface")
297 }
298 if _, ok := w.(http.Hijacker); ok != false {
299 t.Error("unexpected interface")
300 }
301 if _, ok := w.(io.ReaderFrom); ok != false {
302 t.Error("unexpected interface")
303 }
304
305 if w, ok := w.(Unwrapper); ok {
306 if w.Unwrap() != inner {
307 t.Error("w.Unwrap() failed")
308 }
309 } else {
310 t.Error("Unwrapper interface not implemented")
311 }
312 }
313
314
315 {
316 t.Log("http.ResponseWriter, http.Flusher, io.ReaderFrom")
317 inner := struct {
318 http.ResponseWriter
319 http.Flusher
320 io.ReaderFrom
321 }{}
322 w := Wrap(inner, Hooks{})
323 if _, ok := w.(http.ResponseWriter); ok != true {
324 t.Error("unexpected interface")
325 }
326 if _, ok := w.(http.Flusher); ok != true {
327 t.Error("unexpected interface")
328 }
329 if _, ok := w.(http.CloseNotifier); ok != false {
330 t.Error("unexpected interface")
331 }
332 if _, ok := w.(http.Hijacker); ok != false {
333 t.Error("unexpected interface")
334 }
335 if _, ok := w.(io.ReaderFrom); ok != true {
336 t.Error("unexpected interface")
337 }
338
339 if w, ok := w.(Unwrapper); ok {
340 if w.Unwrap() != inner {
341 t.Error("w.Unwrap() failed")
342 }
343 } else {
344 t.Error("Unwrapper interface not implemented")
345 }
346 }
347
348
349 {
350 t.Log("http.ResponseWriter, http.Flusher, http.Hijacker")
351 inner := struct {
352 http.ResponseWriter
353 http.Flusher
354 http.Hijacker
355 }{}
356 w := Wrap(inner, Hooks{})
357 if _, ok := w.(http.ResponseWriter); ok != true {
358 t.Error("unexpected interface")
359 }
360 if _, ok := w.(http.Flusher); ok != true {
361 t.Error("unexpected interface")
362 }
363 if _, ok := w.(http.CloseNotifier); ok != false {
364 t.Error("unexpected interface")
365 }
366 if _, ok := w.(http.Hijacker); ok != true {
367 t.Error("unexpected interface")
368 }
369 if _, ok := w.(io.ReaderFrom); ok != false {
370 t.Error("unexpected interface")
371 }
372
373 if w, ok := w.(Unwrapper); ok {
374 if w.Unwrap() != inner {
375 t.Error("w.Unwrap() failed")
376 }
377 } else {
378 t.Error("Unwrapper interface not implemented")
379 }
380 }
381
382
383 {
384 t.Log("http.ResponseWriter, http.Flusher, http.Hijacker, io.ReaderFrom")
385 inner := struct {
386 http.ResponseWriter
387 http.Flusher
388 http.Hijacker
389 io.ReaderFrom
390 }{}
391 w := Wrap(inner, Hooks{})
392 if _, ok := w.(http.ResponseWriter); ok != true {
393 t.Error("unexpected interface")
394 }
395 if _, ok := w.(http.Flusher); ok != true {
396 t.Error("unexpected interface")
397 }
398 if _, ok := w.(http.CloseNotifier); ok != false {
399 t.Error("unexpected interface")
400 }
401 if _, ok := w.(http.Hijacker); ok != true {
402 t.Error("unexpected interface")
403 }
404 if _, ok := w.(io.ReaderFrom); ok != true {
405 t.Error("unexpected interface")
406 }
407
408 if w, ok := w.(Unwrapper); ok {
409 if w.Unwrap() != inner {
410 t.Error("w.Unwrap() failed")
411 }
412 } else {
413 t.Error("Unwrapper interface not implemented")
414 }
415 }
416
417
418 {
419 t.Log("http.ResponseWriter, http.Flusher, http.CloseNotifier")
420 inner := struct {
421 http.ResponseWriter
422 http.Flusher
423 http.CloseNotifier
424 }{}
425 w := Wrap(inner, Hooks{})
426 if _, ok := w.(http.ResponseWriter); ok != true {
427 t.Error("unexpected interface")
428 }
429 if _, ok := w.(http.Flusher); ok != true {
430 t.Error("unexpected interface")
431 }
432 if _, ok := w.(http.CloseNotifier); ok != true {
433 t.Error("unexpected interface")
434 }
435 if _, ok := w.(http.Hijacker); ok != false {
436 t.Error("unexpected interface")
437 }
438 if _, ok := w.(io.ReaderFrom); ok != false {
439 t.Error("unexpected interface")
440 }
441
442 if w, ok := w.(Unwrapper); ok {
443 if w.Unwrap() != inner {
444 t.Error("w.Unwrap() failed")
445 }
446 } else {
447 t.Error("Unwrapper interface not implemented")
448 }
449 }
450
451
452 {
453 t.Log("http.ResponseWriter, http.Flusher, http.CloseNotifier, io.ReaderFrom")
454 inner := struct {
455 http.ResponseWriter
456 http.Flusher
457 http.CloseNotifier
458 io.ReaderFrom
459 }{}
460 w := Wrap(inner, Hooks{})
461 if _, ok := w.(http.ResponseWriter); ok != true {
462 t.Error("unexpected interface")
463 }
464 if _, ok := w.(http.Flusher); ok != true {
465 t.Error("unexpected interface")
466 }
467 if _, ok := w.(http.CloseNotifier); ok != true {
468 t.Error("unexpected interface")
469 }
470 if _, ok := w.(http.Hijacker); ok != false {
471 t.Error("unexpected interface")
472 }
473 if _, ok := w.(io.ReaderFrom); ok != true {
474 t.Error("unexpected interface")
475 }
476
477 if w, ok := w.(Unwrapper); ok {
478 if w.Unwrap() != inner {
479 t.Error("w.Unwrap() failed")
480 }
481 } else {
482 t.Error("Unwrapper interface not implemented")
483 }
484 }
485
486
487 {
488 t.Log("http.ResponseWriter, http.Flusher, http.CloseNotifier, http.Hijacker")
489 inner := struct {
490 http.ResponseWriter
491 http.Flusher
492 http.CloseNotifier
493 http.Hijacker
494 }{}
495 w := Wrap(inner, Hooks{})
496 if _, ok := w.(http.ResponseWriter); ok != true {
497 t.Error("unexpected interface")
498 }
499 if _, ok := w.(http.Flusher); ok != true {
500 t.Error("unexpected interface")
501 }
502 if _, ok := w.(http.CloseNotifier); ok != true {
503 t.Error("unexpected interface")
504 }
505 if _, ok := w.(http.Hijacker); ok != true {
506 t.Error("unexpected interface")
507 }
508 if _, ok := w.(io.ReaderFrom); ok != false {
509 t.Error("unexpected interface")
510 }
511
512 if w, ok := w.(Unwrapper); ok {
513 if w.Unwrap() != inner {
514 t.Error("w.Unwrap() failed")
515 }
516 } else {
517 t.Error("Unwrapper interface not implemented")
518 }
519 }
520
521
522 {
523 t.Log("http.ResponseWriter, http.Flusher, http.CloseNotifier, http.Hijacker, io.ReaderFrom")
524 inner := struct {
525 http.ResponseWriter
526 http.Flusher
527 http.CloseNotifier
528 http.Hijacker
529 io.ReaderFrom
530 }{}
531 w := Wrap(inner, Hooks{})
532 if _, ok := w.(http.ResponseWriter); ok != true {
533 t.Error("unexpected interface")
534 }
535 if _, ok := w.(http.Flusher); ok != true {
536 t.Error("unexpected interface")
537 }
538 if _, ok := w.(http.CloseNotifier); ok != true {
539 t.Error("unexpected interface")
540 }
541 if _, ok := w.(http.Hijacker); ok != true {
542 t.Error("unexpected interface")
543 }
544 if _, ok := w.(io.ReaderFrom); ok != true {
545 t.Error("unexpected interface")
546 }
547
548 if w, ok := w.(Unwrapper); ok {
549 if w.Unwrap() != inner {
550 t.Error("w.Unwrap() failed")
551 }
552 } else {
553 t.Error("Unwrapper interface not implemented")
554 }
555 }
556
557 }
558
View as plain text