MCPcopy Create free account
hub / github.com/cli/cli / Test_newIOStreams_pager

Function Test_newIOStreams_pager

internal/ghcmd/cmd_test.go:171–235  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

169}
170
171func 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 {

Callers

nothing calls this directly

Calls 6

NewMockConfigFunction · 0.92
pagerConfigFunction · 0.85
newIOStreamsFunction · 0.85
EqualMethod · 0.80
GetPagerMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected