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

Function TestNoteIterator

note_test.go:30–65  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

28}
29
30func TestNoteIterator(t *testing.T) {
31 t.Parallel()
32 repo := createTestRepo(t)
33 defer cleanupTestRepo(t, repo)
34
35 seedTestRepo(t, repo)
36
37 notes := make([]*Note, 5)
38 for i := range notes {
39 commitId, _ := updateReadme(t, repo, fmt.Sprintf("README v%d\n", i+1))
40 commit, err := repo.LookupCommit(commitId)
41 checkFatal(t, err)
42
43 note, _ := createTestNote(t, repo, commit)
44 notes[i] = note
45 }
46
47 iter, err := repo.NewNoteIterator("")
48 checkFatal(t, err)
49 for {
50 noteId, commitId, err := iter.Next()
51 if err != nil {
52 if !IsErrorCode(err, ErrorCodeIterOver) {
53 checkFatal(t, err)
54 }
55 break
56 }
57
58 note, err := repo.Notes.Read("", commitId)
59 checkFatal(t, err)
60
61 if !reflect.DeepEqual(note.Id(), noteId) {
62 t.Errorf("expected note oid '%v', actual '%v'", note.Id(), noteId)
63 }
64 }
65}
66
67func TestRemoveNote(t *testing.T) {
68 t.Parallel()

Callers

nothing calls this directly

Calls 12

NextMethod · 0.95
createTestRepoFunction · 0.85
cleanupTestRepoFunction · 0.85
seedTestRepoFunction · 0.85
updateReadmeFunction · 0.85
checkFatalFunction · 0.85
createTestNoteFunction · 0.85
IsErrorCodeFunction · 0.85
LookupCommitMethod · 0.80
NewNoteIteratorMethod · 0.80
ReadMethod · 0.45
IdMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…