aboutsummaryrefslogtreecommitdiffstats
path: root/references_test.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2016-12-02 00:44:06 +0100
committerMáximo Cuadros <mcuadros@gmail.com>2016-12-02 00:44:06 +0100
commit6996381ae43936e7365395e90c8f93372e49be9f (patch)
treeed0d9441157a62230b0b9ca57ef600fd2ba99f76 /references_test.go
parentc15bf1dff332873644290db0e186b8f5ad9b8fb2 (diff)
downloadgo-git-6996381ae43936e7365395e90c8f93372e49be9f.tar.gz
BaseSuite improvements, usage of file:// proto
Diffstat (limited to 'references_test.go')
-rw-r--r--references_test.go26
1 files changed, 11 insertions, 15 deletions
diff --git a/references_test.go b/references_test.go
index f5a2fdc..2147f49 100644
--- a/references_test.go
+++ b/references_test.go
@@ -286,17 +286,11 @@ var referencesTests = [...]struct {
*/
}
-func (s *ReferencesSuite) SetUpSuite(c *C) {
- s.BaseSuite.SetUpSuite(c)
- s.buildRepositories(c, fixtures.All().ByTag("packfile"))
-}
-
func (s *ReferencesSuite) TestRevList(c *C) {
for _, t := range referencesTests {
- repo, ok := s.Repositories[t.repo]
- c.Assert(ok, Equals, true)
+ r := s.NewRepositoryFromPackfile(fixtures.ByURL(t.repo).One())
- commit, err := repo.Commit(plumbing.NewHash(t.commit))
+ commit, err := r.Commit(plumbing.NewHash(t.commit))
c.Assert(err, IsNil)
revs, err := commit.References(t.path)
@@ -305,7 +299,7 @@ func (s *ReferencesSuite) TestRevList(c *C) {
for i := range revs {
if revs[i].Hash.String() != t.revs[i] {
- commit, err := repo.Commit(plumbing.NewHash(t.revs[i]))
+ commit, err := s.Repository.Commit(plumbing.NewHash(t.revs[i]))
c.Assert(err, IsNil)
equiv, err := equivalent(t.path, revs[i], commit)
c.Assert(err, IsNil)
@@ -358,14 +352,16 @@ func (s *ReferencesSuite) TestEquivalent(c *C) {
}
// returns the commits from a slice of hashes
-func (s *ReferencesSuite) commits(cc *C, repo string, hs ...string) []*Commit {
- r, ok := s.Repositories[repo]
- cc.Assert(ok, Equals, true)
+func (s *ReferencesSuite) commits(c *C, repo string, hs ...string) []*Commit {
+ r := s.NewRepositoryFromPackfile(fixtures.ByURL(repo).One())
+
result := make([]*Commit, 0, len(hs))
for _, h := range hs {
- c, err := r.Commit(plumbing.NewHash(h))
- cc.Assert(err, IsNil)
- result = append(result, c)
+ commit, err := r.Commit(plumbing.NewHash(h))
+ c.Assert(err, IsNil)
+
+ result = append(result, commit)
}
+
return result
}