(t *testing.T)
| 2083 | } |
| 2084 | |
| 2085 | func TestResponse_populatePageValues_invalid(t *testing.T) { |
| 2086 | t.Parallel() |
| 2087 | r := http.Response{ |
| 2088 | Header: http.Header{ |
| 2089 | "Link": { |
| 2090 | `<https://api.github.com/?page=1>,` + |
| 2091 | `<https://api.github.com/?page=abc>; rel="first",` + |
| 2092 | `https://api.github.com/?page=2; rel="prev",` + |
| 2093 | `<https://api.github.com/>; rel="next",` + |
| 2094 | `<https://api.github.com/?page=>; rel="last"`, |
| 2095 | }, |
| 2096 | }, |
| 2097 | } |
| 2098 | |
| 2099 | response := newResponse(&r) |
| 2100 | if got, want := response.FirstPage, 0; got != want { |
| 2101 | t.Errorf("response.FirstPage: %v, want %v", got, want) |
| 2102 | } |
| 2103 | if got, want := response.PrevPage, 0; got != want { |
| 2104 | t.Errorf("response.PrevPage: %v, want %v", got, want) |
| 2105 | } |
| 2106 | if got, want := response.NextPage, 0; got != want { |
| 2107 | t.Errorf("response.NextPage: %v, want %v", got, want) |
| 2108 | } |
| 2109 | if got, want := response.LastPage, 0; got != want { |
| 2110 | t.Errorf("response.LastPage: %v, want %v", got, want) |
| 2111 | } |
| 2112 | |
| 2113 | // more invalid URLs |
| 2114 | r = http.Response{ |
| 2115 | Header: http.Header{ |
| 2116 | "Link": {`<https://api.github.com/%?page=2>; rel="first"`}, |
| 2117 | }, |
| 2118 | } |
| 2119 | |
| 2120 | response = newResponse(&r) |
| 2121 | if got, want := response.FirstPage, 0; got != want { |
| 2122 | t.Errorf("response.FirstPage: %v, want %v", got, want) |
| 2123 | } |
| 2124 | } |
| 2125 | |
| 2126 | func TestResponse_populateSinceValues_invalid(t *testing.T) { |
| 2127 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…