aboutsummaryrefslogtreecommitdiffstats
path: root/formats/packfile/decoder_test.go
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/packfile/decoder_test.go
parent58fe211f1b0e4863b425542d2fad15803276fd66 (diff)
downloadgo-git-d57f90b78eeb6b09b15e3fe57609ede66df4edac.tar.gz
fixtures: new fixture package being use in all packages
Diffstat (limited to 'formats/packfile/decoder_test.go')
-rw-r--r--formats/packfile/decoder_test.go37
1 files changed, 17 insertions, 20 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) {