aboutsummaryrefslogtreecommitdiffstats
path: root/formats
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2016-09-12 02:22:08 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2016-09-12 02:22:08 +0200
commitd57f90b78eeb6b09b15e3fe57609ede66df4edac (patch)
tree961aa929391c0e804f32d26016f9e385f6e70ecb /formats
parent58fe211f1b0e4863b425542d2fad15803276fd66 (diff)
downloadgo-git-d57f90b78eeb6b09b15e3fe57609ede66df4edac.tar.gz
fixtures: new fixture package being use in all packages
Diffstat (limited to 'formats')
-rw-r--r--formats/idxfile/decoder_test.go6
-rw-r--r--formats/idxfile/encoder_test.go4
-rw-r--r--formats/packfile/decoder_test.go37
-rw-r--r--formats/packfile/scanner_test.go8
4 files changed, 24 insertions, 31 deletions
diff --git a/formats/idxfile/decoder_test.go b/formats/idxfile/decoder_test.go
index cd90465..8ce2bc7 100644
--- a/formats/idxfile/decoder_test.go
+++ b/formats/idxfile/decoder_test.go
@@ -13,7 +13,9 @@ import (
func Test(t *testing.T) { TestingT(t) }
-type IdxfileSuite struct{}
+type IdxfileSuite struct {
+ fixtures.Suite
+}
var _ = Suite(&IdxfileSuite{})
@@ -35,7 +37,7 @@ func (s *IdxfileSuite) TestDecode(c *C) {
}
func (s *IdxfileSuite) TestDecodeCRCs(c *C) {
- f := fixtures.Basic().ByTag("ofs-delta")
+ f := fixtures.Basic().ByTag("ofs-delta").One()
scanner := packfile.NewScanner(f.Packfile())
storage := memory.NewStorage()
diff --git a/formats/idxfile/encoder_test.go b/formats/idxfile/encoder_test.go
index 380b8e8..d9d83eb 100644
--- a/formats/idxfile/encoder_test.go
+++ b/formats/idxfile/encoder_test.go
@@ -9,10 +9,6 @@ import (
"gopkg.in/src-d/go-git.v4/fixtures"
)
-func (s *IdxfileSuite) SetUpSuite(c *C) {
- fixtures.RootFolder = "../../fixtures"
-}
-
func (s *IdxfileSuite) TestEncode(c *C) {
expected := &Idxfile{}
expected.Add(core.NewHash("4bfc730165c370df4a012afbb45ba3f9c332c0d4"), 82, 82)
diff --git a/formats/packfile/decoder_test.go b/formats/packfile/decoder_test.go
index d85f3bf..9fe6142 100644
--- a/formats/packfile/decoder_test.go
+++ b/formats/packfile/decoder_test.go
@@ -14,14 +14,12 @@ import (
func Test(t *testing.T) { TestingT(t) }
-type ReaderSuite struct{}
+type ReaderSuite struct {
+ fixtures.Suite
+}
var _ = Suite(&ReaderSuite{})
-func (s *ReaderSuite) SetUpSuite(c *C) {
- fixtures.RootFolder = "../../fixtures"
-}
-
func (s *ReaderSuite) TestDecode(c *C) {
fixtures.Basic().Test(c, func(f *fixtures.Fixture) {
scanner := NewScanner(f.Packfile())
@@ -88,24 +86,23 @@ func (s *ReaderSuite) TestDecodeCRCs(c *C) {
}
func (s *ReaderSuite) TestReadObjectAt(c *C) {
- fixtures.Basic().Test(c, func(f *fixtures.Fixture) {
- scanner := NewScanner(f.Packfile())
- storage := memory.NewStorage()
+ f := fixtures.Basic().One()
+ scanner := NewScanner(f.Packfile())
+ storage := memory.NewStorage()
- d := NewDecoder(scanner, storage.ObjectStorage())
+ d := NewDecoder(scanner, storage.ObjectStorage())
- // when the packfile is ref-delta based, the offsets are required
- if f.Is("ref-delta") {
- offsets := getOffsetsFromIdx(f.Idx())
- d.SetOffsets(offsets)
- }
+ // when the packfile is ref-delta based, the offsets are required
+ if f.Is("ref-delta") {
+ offsets := getOffsetsFromIdx(f.Idx())
+ d.SetOffsets(offsets)
+ }
- // the objects at reference 186, is a delta, so should be recall,
- // without being read before.
- obj, err := d.ReadObjectAt(186)
- c.Assert(err, IsNil)
- c.Assert(obj.Hash().String(), Equals, "6ecf0ef2c2dffb796033e5a02219af86ec6584e5")
- })
+ // the objects at reference 186, is a delta, so should be recall,
+ // without being read before.
+ obj, err := d.ReadObjectAt(186)
+ c.Assert(err, IsNil)
+ c.Assert(obj.Hash().String(), Equals, "6ecf0ef2c2dffb796033e5a02219af86ec6584e5")
}
func AssertObjects(c *C, s *memory.Storage, expects []string) {
diff --git a/formats/packfile/scanner_test.go b/formats/packfile/scanner_test.go
index 6161fdb..d9fe13c 100644
--- a/formats/packfile/scanner_test.go
+++ b/formats/packfile/scanner_test.go
@@ -8,14 +8,12 @@ import (
"gopkg.in/src-d/go-git.v4/fixtures"
)
-type ScannerSuite struct{}
+type ScannerSuite struct {
+ fixtures.Suite
+}
var _ = Suite(&ScannerSuite{})
-func (s *ScannerSuite) SetUpSuite(c *C) {
- fixtures.RootFolder = "../../fixtures"
-}
-
func (s *ScannerSuite) TestHeader(c *C) {
r := fixtures.Basic().One().Packfile()
p := NewScanner(r)