MCPcopy Create free account
hub / github.com/github/gh-aw / TestIsHexString

Function TestIsHexString

pkg/gitutil/gitutil_test.go:141–205  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

139}
140
141func 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

Callers

nothing calls this directly

Calls 2

IsHexStringFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected