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

Function checkStashes

stash_test.go:130–152  ·  view source on GitHub ↗
(t *testing.T, repo *Repository, expected []stash)

Source from the content-addressed store, hash-verified

128}
129
130func checkStashes(t *testing.T, repo *Repository, expected []stash) {
131 var actual []stash
132
133 repo.Stashes.Foreach(func(index int, msg string, id *Oid) error {
134 stash := stash{index, msg, id.String()}
135 if len(expected) > len(actual) {
136 if s := expected[len(actual)]; s.id == "" {
137 stash.id = "" // don't check id
138 }
139 }
140 actual = append(actual, stash)
141 return nil
142 })
143
144 if len(expected) > 0 && !reflect.DeepEqual(expected, actual) {
145 // The failure happens at wherever we were called, not here
146 _, file, line, ok := runtime.Caller(1)
147 if !ok {
148 t.Fatalf("Unable to get caller")
149 }
150 t.Errorf("%v:%v: expecting %#v\ngot %#v", path.Base(file), line, expected, actual)
151 }
152}
153
154func prepareStashRepo(t *testing.T, repo *Repository) {
155 seedTestRepo(t, repo)

Callers 1

TestStashFunction · 0.85

Calls 2

ForeachMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…