Skip to content

Commit

Permalink
add commit_id and filename testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Vialeon committed Jan 18, 2021
1 parent 284bb94 commit 2361e32
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions pkg/gitqlite/blame_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,49 @@ func TestBlameContents(t *testing.T) {
}
}
}
func TestBlameCommitID(t *testing.T) {
iterator, err := NewBlameIterator(fixtureRepo)
if err != nil {
t.Fatal(err)
}
rows, err := fixtureDB.Query("SELECT commit_id from blame limit 100")
if err != nil {
t.Fatal(err)
}
_, lines, err := GetRowContents(rows)
if err != nil {
t.Fatal(err)
}
for _, line := range lines {
cont, err := iterator.Next()
if err != nil {
t.Fatal(err)
}
if !(line[0] == cont.CommitID) {
t.Fatalf("expected %s content in blame, got %s", cont.Content, line[0])
}
}
}
func TestBlameFileNames(t *testing.T) {
iterator, err := NewBlameIterator(fixtureRepo)
if err != nil {
t.Fatal(err)
}
rows, err := fixtureDB.Query("SELECT path from blame limit 100")
if err != nil {
t.Fatal(err)
}
_, lines, err := GetRowContents(rows)
if err != nil {
t.Fatal(err)
}
for _, line := range lines {
cont, err := iterator.Next()
if err != nil {
t.Fatal(err)
}
if !(line[0] == cont.File) {
t.Fatalf("expected %s content in blame, got %s", cont.Content, line[0])
}
}
}

0 comments on commit 2361e32

Please sign in to comment.