(t *testing.T)
| 19 | ) |
| 20 | |
| 21 | func TestMustSendMethods(t *testing.T) { |
| 22 | c := tc() |
| 23 | testCases := []struct { |
| 24 | SendReq func(req *Request, url string) *Response |
| 25 | ExpectMethod string |
| 26 | }{ |
| 27 | { |
| 28 | SendReq: func(req *Request, url string) *Response { |
| 29 | return req.MustGet(url) |
| 30 | }, |
| 31 | ExpectMethod: "GET", |
| 32 | }, |
| 33 | { |
| 34 | SendReq: func(req *Request, url string) *Response { |
| 35 | return req.MustPost(url) |
| 36 | }, |
| 37 | ExpectMethod: "POST", |
| 38 | }, |
| 39 | { |
| 40 | SendReq: func(req *Request, url string) *Response { |
| 41 | return req.MustPatch(url) |
| 42 | }, |
| 43 | ExpectMethod: "PATCH", |
| 44 | }, |
| 45 | { |
| 46 | SendReq: func(req *Request, url string) *Response { |
| 47 | return req.MustDelete(url) |
| 48 | }, |
| 49 | ExpectMethod: "DELETE", |
| 50 | }, |
| 51 | { |
| 52 | SendReq: func(req *Request, url string) *Response { |
| 53 | return req.MustOptions(url) |
| 54 | }, |
| 55 | ExpectMethod: "OPTIONS", |
| 56 | }, |
| 57 | { |
| 58 | SendReq: func(req *Request, url string) *Response { |
| 59 | return req.MustPut(url) |
| 60 | }, |
| 61 | ExpectMethod: "PUT", |
| 62 | }, |
| 63 | { |
| 64 | SendReq: func(req *Request, url string) *Response { |
| 65 | return req.MustHead(url) |
| 66 | }, |
| 67 | ExpectMethod: "HEAD", |
| 68 | }, |
| 69 | } |
| 70 | |
| 71 | for _, tc := range testCases { |
| 72 | testMethod(t, c, func(req *Request) *Response { |
| 73 | return tc.SendReq(req, "/") |
| 74 | }, tc.ExpectMethod, false) |
| 75 | } |
| 76 | |
| 77 | // test panic |
| 78 | for _, tc := range testCases { |
nothing calls this directly
no test coverage detected
searching dependent graphs…