-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgit_up_test.go
66 lines (55 loc) · 1.37 KB
/
git_up_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package gitgo_test
import (
"testing"
"github.com/go-xlan/gitgo"
"github.com/stretchr/testify/require"
"github.com/yyle88/runpath"
)
func TestGcm_HasStagingChanges(t *testing.T) {
gcm := gitgo.New(runpath.PARENT.Path())
changes, err := gcm.HasStagingChanges()
require.NoError(t, err)
t.Log(changes)
}
func TestGcm_CheckStagedChanges(t *testing.T) {
gcm := gitgo.New(runpath.PARENT.Path())
gcm.WithDebug().
Status().
Add().
CheckStagedChanges().
ShowDebugMessage().
Status().
ShowDebugMessage()
}
func TestLatestGitTag(t *testing.T) {
gcm := gitgo.New(runpath.PARENT.Path()).WithDebug()
tag, err := gcm.LatestGitTag()
require.NoError(t, err)
t.Log(tag)
require.NotEmpty(t, tag)
}
func TestGitCommitHash(t *testing.T) {
gcm := gitgo.New(runpath.PARENT.Path()).WithDebug()
hash, err := gcm.GitCommitHash("main")
require.NoError(t, err)
t.Log(hash)
require.NotEmpty(t, hash)
}
func TestGitCommitHash_TAG(t *testing.T) {
gcm := gitgo.New(runpath.PARENT.Path()).WithDebug()
tag, err := gcm.LatestGitTag()
require.NoError(t, err)
t.Log(tag)
require.NotEmpty(t, tag)
hash, err := gcm.GitCommitHash(tag)
require.NoError(t, err)
t.Log(hash)
require.NotEmpty(t, hash)
}
func TestGcm_SortedGitTags(t *testing.T) {
gcm := gitgo.New(runpath.PARENT.Path()).WithDebug()
tag, err := gcm.SortedGitTags()
require.NoError(t, err)
t.Log(tag)
require.NotEmpty(t, tag)
}