aboutsummaryrefslogtreecommitdiffstats
path: root/formats/packfile
diff options
context:
space:
mode:
Diffstat (limited to 'formats/packfile')
-rw-r--r--formats/packfile/decoder_test.go37
-rw-r--r--formats/packfile/scanner_test.go8
2 files changed, 20 insertions, 25 deletions
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)