@@ -62,6 +62,10 @@ func TestRepository_HasReference(t *testing.T) {
62
62
ref : RefsHeads + "master" ,
63
63
expVal : true ,
64
64
},
65
+ {
66
+ ref : RefsTags + "v1.0.0" ,
67
+ expVal : true ,
68
+ },
65
69
{
66
70
ref : "master" ,
67
71
expVal : false ,
@@ -74,6 +78,50 @@ func TestRepository_HasReference(t *testing.T) {
74
78
}
75
79
}
76
80
81
+ func TestRepository_HasBranch (t * testing.T ) {
82
+ tests := []struct {
83
+ ref string
84
+ opt ShowRefVerifyOptions
85
+ expVal bool
86
+ }{
87
+ {
88
+ ref : "master" ,
89
+ expVal : true ,
90
+ },
91
+ {
92
+ ref : RefsHeads + "master" ,
93
+ expVal : false ,
94
+ },
95
+ }
96
+ for _ , test := range tests {
97
+ t .Run ("" , func (t * testing.T ) {
98
+ assert .Equal (t , test .expVal , testrepo .HasBranch (test .ref , test .opt ))
99
+ })
100
+ }
101
+ }
102
+
103
+ func TestRepository_HasTag (t * testing.T ) {
104
+ tests := []struct {
105
+ ref string
106
+ opt ShowRefVerifyOptions
107
+ expVal bool
108
+ }{
109
+ {
110
+ ref : "v1.0.0" ,
111
+ expVal : true ,
112
+ },
113
+ {
114
+ ref : RefsTags + "v1.0.0" ,
115
+ expVal : false ,
116
+ },
117
+ }
118
+ for _ , test := range tests {
119
+ t .Run ("" , func (t * testing.T ) {
120
+ assert .Equal (t , test .expVal , testrepo .HasTag (test .ref , test .opt ))
121
+ })
122
+ }
123
+ }
124
+
77
125
func TestRepository_SymbolicRef (t * testing.T ) {
78
126
r , cleanup , err := setupTempRepo ()
79
127
if err != nil {
0 commit comments