aboutsummaryrefslogtreecommitdiffstats
path: root/blame_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 /blame_test.go
parentc15bf1dff332873644290db0e186b8f5ad9b8fb2 (diff)
downloadgo-git-6996381ae43936e7365395e90c8f93372e49be9f.tar.gz
BaseSuite improvements, usage of file:// proto
Diffstat (limited to 'blame_test.go')
-rw-r--r--blame_test.go42
1 files changed, 16 insertions, 26 deletions
diff --git a/blame_test.go b/blame_test.go
index 53f2271..f4203b8 100644
--- a/blame_test.go
+++ b/blame_test.go
@@ -20,12 +20,24 @@ type blameTest struct {
blames []string // the commits blamed for each line
}
-func (s *BlameSuite) mockBlame(t blameTest, c *C) (blame *Blame) {
- r, ok := s.Repositories[t.repo]
- c.Assert(ok, Equals, true)
+// run a blame on all the suite's tests
+func (s *BlameSuite) TestBlame(c *C) {
+ for _, t := range blameTests {
+ r := s.NewRepositoryFromPackfile(fixtures.ByURL(t.repo).One())
+
+ exp := s.mockBlame(c, t, r)
+ commit, err := r.Commit(plumbing.NewHash(t.rev))
+ c.Assert(err, IsNil)
+
+ obt, err := commit.Blame(t.path)
+ c.Assert(err, IsNil)
+ c.Assert(obt, DeepEquals, exp)
+ }
+}
+func (s *BlameSuite) mockBlame(c *C, t blameTest, r *Repository) (blame *Blame) {
commit, err := r.Commit(plumbing.NewHash(t.rev))
- c.Assert(err, IsNil, Commentf("%v: repo=%s, rev=%s", err, r, t.rev))
+ c.Assert(err, IsNil, Commentf("%v: repo=%s, rev=%s", err, t.repo, t.rev))
f, err := commit.File(t.path)
c.Assert(err, IsNil)
@@ -52,28 +64,6 @@ func (s *BlameSuite) mockBlame(t blameTest, c *C) (blame *Blame) {
}
}
-func (s *BlameSuite) SetUpSuite(c *C) {
- s.BaseSuite.SetUpSuite(c)
- s.buildRepositories(c, fixtures.ByTag("packfile"))
-}
-
-// run a blame on all the suite's tests
-func (s *BlameSuite) TestBlame(c *C) {
- for _, t := range blameTests {
- exp := s.mockBlame(t, c)
-
- r, ok := s.Repositories[t.repo]
- c.Assert(ok, Equals, true)
-
- commit, err := r.Commit(plumbing.NewHash(t.rev))
- c.Assert(err, IsNil)
-
- obt, err := commit.Blame(t.path)
- c.Assert(err, IsNil)
- c.Assert(obt, DeepEquals, exp)
- }
-}
-
// utility function to avoid writing so many repeated commits
func repeat(s string, n int) []string {
if n < 0 {