MCPcopy Create free account
hub / github.com/libgit2/git2go / TestReferenceNormalizeName

Function TestReferenceNormalizeName

reference_test.go:231–252  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

229}
230
231func TestReferenceNormalizeName(t *testing.T) {
232 t.Parallel()
233
234 ref, err := ReferenceNormalizeName("refs/heads//master", ReferenceFormatNormal)
235 checkFatal(t, err)
236
237 if ref != "refs/heads/master" {
238 t.Errorf("ReferenceNormalizeName(%q) = %q; want %q", "refs/heads//master", ref, "refs/heads/master")
239 }
240
241 ref, err = ReferenceNormalizeName("master", ReferenceFormatAllowOnelevel|ReferenceFormatRefspecShorthand)
242 checkFatal(t, err)
243
244 if ref != "master" {
245 t.Errorf("ReferenceNormalizeName(%q) = %q; want %q", "master", ref, "master")
246 }
247
248 ref, err = ReferenceNormalizeName("foo^", ReferenceFormatNormal)
249 if !IsErrorCode(err, ErrorCodeInvalidSpec) {
250 t.Errorf("foo^ should be invalid")
251 }
252}
253
254func compareStringList(t *testing.T, expected, actual []string) {
255 for i, v := range expected {

Callers

nothing calls this directly

Calls 3

ReferenceNormalizeNameFunction · 0.85
checkFatalFunction · 0.85
IsErrorCodeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…