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