Skip to content

Commit 1abe8c2

Browse files
committed
fix tests
1 parent 3e038cd commit 1abe8c2

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

modules/git/commit_test.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,32 @@
55
package git
66

77
import (
8+
"path/filepath"
89
"testing"
910

1011
"github.com/stretchr/testify/assert"
1112
)
1213

1314
func TestCommitsCount(t *testing.T) {
14-
commitsCount, err := CommitsCount(".", "4836fea8767c38f175f59f8f66579e76fe6354f5")
15+
p, err := filepath.Abs(".")
16+
assert.NoError(t, err)
17+
commitsCount, err := CommitsCount(p, "4836fea8767c38f175f59f8f66579e76fe6354f5")
1518
assert.NoError(t, err)
1619
assert.Equal(t, int64(3), commitsCount)
1720
}
1821

1922
func TestGetFullCommitID(t *testing.T) {
20-
id, err := GetFullCommitID(".", "4836fea8")
23+
p, err := filepath.Abs(".")
24+
assert.NoError(t, err)
25+
id, err := GetFullCommitID(p, "4836fea8")
2126
assert.NoError(t, err)
2227
assert.Equal(t, "4836fea8767c38f175f59f8f66579e76fe6354f5", id)
2328
}
2429

2530
func TestGetFullCommitIDError(t *testing.T) {
26-
id, err := GetFullCommitID(".", "unknown")
31+
p, err := filepath.Abs(".")
32+
assert.NoError(t, err)
33+
id, err := GetFullCommitID(p, "unknown")
2734
assert.Empty(t, id)
2835
if assert.Error(t, err) {
2936
assert.EqualError(t, err, "object does not exist [id: unknown, rel_path: ]")

0 commit comments

Comments
 (0)