diff options
Diffstat (limited to 'repository_test.go')
-rw-r--r-- | repository_test.go | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/repository_test.go b/repository_test.go index d7fe20e..202c931 100644 --- a/repository_test.go +++ b/repository_test.go @@ -1,16 +1,24 @@ package git import ( + "fmt" + "gopkg.in/src-d/go-git.v3/clients/http" "gopkg.in/src-d/go-git.v3/core" . "gopkg.in/check.v1" ) -type SuiteRepository struct{} +type SuiteRepository struct { + repos map[string]*Repository +} var _ = Suite(&SuiteRepository{}) +func (s *SuiteRepository) SetUpTest(c *C) { + s.repos = unpackFixtures(c, tagFixtures) +} + func (s *SuiteRepository) TestNewRepository(c *C) { r, err := NewRepository(RepositoryFixture, nil) c.Assert(err, IsNil) @@ -77,6 +85,28 @@ func (s *SuiteRepository) TestCommits(c *C) { c.Assert(count, Equals, 8) } +func (s *SuiteRepository) TestTag(c *C) { + for i, t := range tagTests { + r, ok := s.repos[t.repo] + c.Assert(ok, Equals, true) + k := 0 + for hash, expected := range t.tags { + tag, err := r.Tag(core.NewHash(hash)) + c.Assert(err, IsNil) + testTagExpected(c, tag, expected, fmt.Sprintf("subtest %d, tag %d: ", i, k)) + k++ + } + } +} + +func (s *SuiteRepository) TestTags(c *C) { + for i, t := range tagTests { + r, ok := s.repos[t.repo] + c.Assert(ok, Equals, true) + testTagIter(c, r.Tags(), t.tags, fmt.Sprintf("subtest %d, ", i)) + } +} + func (s *SuiteRepository) TestCommitIterClosePanic(c *C) { r, err := NewRepository(RepositoryFixture, nil) r.Remotes["origin"].upSrv = &MockGitUploadPackService{} |