TestSpec_PublicAPI_IsHexString validates the documented behavior of IsHexString as described in the package README.md. Specification: Returns true if s consists entirely of hexadecimal characters (0–9, a–f, A–F). Returns false for the empty string.
(t *testing.T)
| 129 | // Specification: Returns true if s consists entirely of hexadecimal characters |
| 130 | // (0–9, a–f, A–F). Returns false for the empty string. |
| 131 | func TestSpec_PublicAPI_IsHexString(t *testing.T) { |
| 132 | tests := []struct { |
| 133 | name string |
| 134 | input string |
| 135 | expected bool |
| 136 | }{ |
| 137 | { |
| 138 | name: "lowercase hex digits returns true", |
| 139 | input: "abcdef0123456789", |
| 140 | expected: true, |
| 141 | }, |
| 142 | { |
| 143 | name: "uppercase hex digits returns true", |
| 144 | input: "ABCDEF0123456789", |
| 145 | expected: true, |
| 146 | }, |
| 147 | { |
| 148 | name: "mixed case hex digits returns true", |
| 149 | input: "AbCdEf01", |
| 150 | expected: true, |
| 151 | }, |
| 152 | { |
| 153 | name: "numeric only returns true", |
| 154 | input: "123456", |
| 155 | expected: true, |
| 156 | }, |
| 157 | { |
| 158 | name: "non-hex character returns false", |
| 159 | input: "abcg", |
| 160 | expected: false, |
| 161 | }, |
| 162 | { |
| 163 | name: "empty string returns false (documented edge case)", |
| 164 | input: "", |
| 165 | expected: false, |
| 166 | }, |
| 167 | { |
| 168 | name: "string with space returns false", |
| 169 | input: "abc def", |
| 170 | expected: false, |
| 171 | }, |
| 172 | } |
| 173 | |
| 174 | for _, tt := range tests { |
| 175 | t.Run(tt.name, func(t *testing.T) { |
| 176 | result := gitutil.IsHexString(tt.input) |
| 177 | assert.Equal(t, tt.expected, result, |
| 178 | "IsHexString(%q) should match documented behavior", tt.input) |
| 179 | }) |
| 180 | } |
| 181 | } |
| 182 | |
| 183 | // TestSpec_PublicAPI_ExtractBaseRepo validates the documented behavior of |
| 184 | // ExtractBaseRepo as described in the package README.md. |
nothing calls this directly
no test coverage detected