@@ -167,9 +167,10 @@ func TestMergeInsertElementsInSubtreeOrder(t *testing.T) {
167167type TreeEntryTypeTestCase struct {
168168 Filemode int32
169169 Expected ObjectType
170+ IsLink bool
170171}
171172
172- func (c * TreeEntryTypeTestCase ) Assert (t * testing.T ) {
173+ func (c * TreeEntryTypeTestCase ) AssertType (t * testing.T ) {
173174 e := & TreeEntry {Filemode : c .Filemode }
174175
175176 got := e .Type ()
@@ -178,14 +179,24 @@ func (c *TreeEntryTypeTestCase) Assert(t *testing.T) {
178179 "gitobj: expected type: %s, got: %s" , c .Expected , got )
179180}
180181
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+
181191func TestTreeEntryTypeResolution (t * testing.T ) {
182192 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 },
187197 } {
188- t .Run (desc , c .Assert )
198+ t .Run (desc , c .AssertType )
199+ t .Run (desc , c .AssertIsLink )
189200 }
190201}
191202
0 commit comments