(t *testing.T)
| 2124 | } |
| 2125 | |
| 2126 | func TestResponse_populateSinceValues_invalid(t *testing.T) { |
| 2127 | t.Parallel() |
| 2128 | r := http.Response{ |
| 2129 | Header: http.Header{ |
| 2130 | "Link": { |
| 2131 | `<https://api.github.com/?since=1>,` + |
| 2132 | `<https://api.github.com/?since=abc>; rel="first",` + |
| 2133 | `https://api.github.com/?since=2; rel="prev",` + |
| 2134 | `<https://api.github.com/>; rel="next",` + |
| 2135 | `<https://api.github.com/?since=>; rel="last"`, |
| 2136 | }, |
| 2137 | }, |
| 2138 | } |
| 2139 | |
| 2140 | response := newResponse(&r) |
| 2141 | if got, want := response.FirstPage, 0; got != want { |
| 2142 | t.Errorf("response.FirstPage: %v, want %v", got, want) |
| 2143 | } |
| 2144 | if got, want := response.PrevPage, 0; got != want { |
| 2145 | t.Errorf("response.PrevPage: %v, want %v", got, want) |
| 2146 | } |
| 2147 | if got, want := response.NextPage, 0; got != want { |
| 2148 | t.Errorf("response.NextPage: %v, want %v", got, want) |
| 2149 | } |
| 2150 | if got, want := response.LastPage, 0; got != want { |
| 2151 | t.Errorf("response.LastPage: %v, want %v", got, want) |
| 2152 | } |
| 2153 | |
| 2154 | // more invalid URLs |
| 2155 | r = http.Response{ |
| 2156 | Header: http.Header{ |
| 2157 | "Link": {`<https://api.github.com/%?since=2>; rel="first"`}, |
| 2158 | }, |
| 2159 | } |
| 2160 | |
| 2161 | response = newResponse(&r) |
| 2162 | if got, want := response.FirstPage, 0; got != want { |
| 2163 | t.Errorf("response.FirstPage: %v, want %v", got, want) |
| 2164 | } |
| 2165 | } |
| 2166 | |
| 2167 | func TestDo(t *testing.T) { |
| 2168 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…