(t *testing.T)
| 169 | } |
| 170 | |
| 171 | func Test_newIOStreams_pager(t *testing.T) { |
| 172 | tests := []struct { |
| 173 | name string |
| 174 | env map[string]string |
| 175 | config gh.Config |
| 176 | wantPager string |
| 177 | }{ |
| 178 | { |
| 179 | name: "GH_PAGER and PAGER set", |
| 180 | env: map[string]string{ |
| 181 | "GH_PAGER": "GH_PAGER", |
| 182 | "PAGER": "PAGER", |
| 183 | }, |
| 184 | wantPager: "GH_PAGER", |
| 185 | }, |
| 186 | { |
| 187 | name: "GH_PAGER and config pager set", |
| 188 | env: map[string]string{ |
| 189 | "GH_PAGER": "GH_PAGER", |
| 190 | }, |
| 191 | config: pagerConfig(), |
| 192 | wantPager: "GH_PAGER", |
| 193 | }, |
| 194 | { |
| 195 | name: "config pager and PAGER set", |
| 196 | env: map[string]string{ |
| 197 | "PAGER": "PAGER", |
| 198 | }, |
| 199 | config: pagerConfig(), |
| 200 | wantPager: "CONFIG_PAGER", |
| 201 | }, |
| 202 | { |
| 203 | name: "only PAGER set", |
| 204 | env: map[string]string{ |
| 205 | "PAGER": "PAGER", |
| 206 | }, |
| 207 | wantPager: "PAGER", |
| 208 | }, |
| 209 | { |
| 210 | name: "GH_PAGER set to blank string", |
| 211 | env: map[string]string{ |
| 212 | "GH_PAGER": "", |
| 213 | "PAGER": "PAGER", |
| 214 | }, |
| 215 | wantPager: "", |
| 216 | }, |
| 217 | } |
| 218 | for _, tt := range tests { |
| 219 | t.Run(tt.name, func(t *testing.T) { |
| 220 | if tt.env != nil { |
| 221 | for k, v := range tt.env { |
| 222 | t.Setenv(k, v) |
| 223 | } |
| 224 | } |
| 225 | var cfg gh.Config |
| 226 | if tt.config != nil { |
| 227 | cfg = tt.config |
| 228 | } else { |
nothing calls this directly
no test coverage detected