(t *testing.T)
| 88 | } |
| 89 | |
| 90 | func 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 { |
nothing calls this directly
no test coverage detected