(t *testing.T)
| 139 | } |
| 140 | |
| 141 | func TestIsHexString(t *testing.T) { |
| 142 | tests := []struct { |
| 143 | name string |
| 144 | input string |
| 145 | expected bool |
| 146 | }{ |
| 147 | { |
| 148 | name: "valid lowercase hex", |
| 149 | input: "deadbeef", |
| 150 | expected: true, |
| 151 | }, |
| 152 | { |
| 153 | name: "valid uppercase hex", |
| 154 | input: "DEADBEEF", |
| 155 | expected: true, |
| 156 | }, |
| 157 | { |
| 158 | name: "valid mixed case hex", |
| 159 | input: "DeAdBeEf", |
| 160 | expected: true, |
| 161 | }, |
| 162 | { |
| 163 | name: "valid full git sha", |
| 164 | input: "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2", |
| 165 | expected: true, |
| 166 | }, |
| 167 | { |
| 168 | name: "digits only", |
| 169 | input: "0123456789", |
| 170 | expected: true, |
| 171 | }, |
| 172 | { |
| 173 | name: "single valid char", |
| 174 | input: "a", |
| 175 | expected: true, |
| 176 | }, |
| 177 | { |
| 178 | name: "invalid char g", |
| 179 | input: "deadbeeg", |
| 180 | expected: false, |
| 181 | }, |
| 182 | { |
| 183 | name: "contains space", |
| 184 | input: "dead beef", |
| 185 | expected: false, |
| 186 | }, |
| 187 | { |
| 188 | name: "empty string", |
| 189 | input: "", |
| 190 | expected: false, |
| 191 | }, |
| 192 | { |
| 193 | name: "non-hex word", |
| 194 | input: "xyz", |
| 195 | expected: false, |
| 196 | }, |
| 197 | } |
| 198 |
nothing calls this directly
no test coverage detected