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

Function Test_newIOStreams_pager

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

Source from the content-addressed store, hash-verified

88}
89
90func Test_newIOStreams_pager(t *testing.T) {
91 tests := []struct {
92 name string
93 env map[string]string
94 config gh.Config
95 wantPager string
96 }{
97 {
98 name: "GH_PAGER and PAGER set",
99 env: map[string]string{
100 "GH_PAGER": "GH_PAGER",
101 "PAGER": "PAGER",
102 },
103 wantPager: "GH_PAGER",
104 },
105 {
106 name: "GH_PAGER and config pager set",
107 env: map[string]string{
108 "GH_PAGER": "GH_PAGER",
109 },
110 config: pagerConfig(),
111 wantPager: "GH_PAGER",
112 },
113 {
114 name: "config pager and PAGER set",
115 env: map[string]string{
116 "PAGER": "PAGER",
117 },
118 config: pagerConfig(),
119 wantPager: "CONFIG_PAGER",
120 },
121 {
122 name: "only PAGER set",
123 env: map[string]string{
124 "PAGER": "PAGER",
125 },
126 wantPager: "PAGER",
127 },
128 {
129 name: "GH_PAGER set to blank string",
130 env: map[string]string{
131 "GH_PAGER": "",
132 "PAGER": "PAGER",
133 },
134 wantPager: "",
135 },
136 }
137 for _, tt := range tests {
138 t.Run(tt.name, func(t *testing.T) {
139 if tt.env != nil {
140 for k, v := range tt.env {
141 t.Setenv(k, v)
142 }
143 }
144 var cfg gh.Config
145 if tt.config != nil {
146 cfg = tt.config
147 } 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