@@ -167,9 +167,10 @@ func TestMergeInsertElementsInSubtreeOrder(t *testing.T) {
167
167
type TreeEntryTypeTestCase struct {
168
168
Filemode int32
169
169
Expected ObjectType
170
+ IsLink bool
170
171
}
171
172
172
- func (c * TreeEntryTypeTestCase ) Assert (t * testing.T ) {
173
+ func (c * TreeEntryTypeTestCase ) AssertType (t * testing.T ) {
173
174
e := & TreeEntry {Filemode : c .Filemode }
174
175
175
176
got := e .Type ()
@@ -178,14 +179,24 @@ func (c *TreeEntryTypeTestCase) Assert(t *testing.T) {
178
179
"gitobj: expected type: %s, got: %s" , c .Expected , got )
179
180
}
180
181
182
+ func (c * TreeEntryTypeTestCase ) AssertIsLink (t * testing.T ) {
183
+ e := & TreeEntry {Filemode : c .Filemode }
184
+
185
+ isLink := e .IsLink ()
186
+
187
+ assert .Equal (t , c .IsLink , isLink ,
188
+ "gitobj: expected link: %v, got: %v, for type %s" , c .IsLink , isLink , c .Expected )
189
+ }
190
+
181
191
func TestTreeEntryTypeResolution (t * testing.T ) {
182
192
for desc , c := range map [string ]* TreeEntryTypeTestCase {
183
- "blob" : {0100644 , BlobObjectType },
184
- "subtree" : {040000 , TreeObjectType },
185
- "symlink" : {0120000 , BlobObjectType },
186
- "commit" : {0160000 , CommitObjectType },
193
+ "blob" : {0100644 , BlobObjectType , false },
194
+ "subtree" : {040000 , TreeObjectType , false },
195
+ "symlink" : {0120000 , BlobObjectType , true },
196
+ "commit" : {0160000 , CommitObjectType , false },
187
197
} {
188
- t .Run (desc , c .Assert )
198
+ t .Run (desc , c .AssertType )
199
+ t .Run (desc , c .AssertIsLink )
189
200
}
190
201
}
191
202
0 commit comments