diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2016-09-22 18:51:21 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2016-09-22 18:51:21 +0200 |
commit | 001bb130fe6186421f3ddcc556854410edd8d95e (patch) | |
tree | 4307c48320a05acf5c1e98b244feae6b3e1828ce | |
parent | 4912552b913f1f575f9cc358b46bcdbe884e7279 (diff) | |
download | go-git-001bb130fe6186421f3ddcc556854410edd8d95e.tar.gz |
cleanup old fixtures
-rw-r--r-- | blame_test.go | 6 | ||||
-rw-r--r-- | commit_test.go | 4 | ||||
-rw-r--r-- | common_test.go | 9 | ||||
-rw-r--r-- | file_test.go | 3 | ||||
-rw-r--r-- | fixtures/fixtures.go | 28 | ||||
-rw-r--r-- | references_test.go | 6 | ||||
-rw-r--r-- | tag_test.go | 6 | ||||
-rw-r--r-- | tree_diff_test.go | 88 |
8 files changed, 82 insertions, 68 deletions
diff --git a/blame_test.go b/blame_test.go index 9cf8992..2d9161c 100644 --- a/blame_test.go +++ b/blame_test.go @@ -2,6 +2,7 @@ package git import ( "gopkg.in/src-d/go-git.v4/core" + "gopkg.in/src-d/go-git.v4/fixtures" . "gopkg.in/check.v1" ) @@ -51,6 +52,11 @@ 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 { diff --git a/commit_test.go b/commit_test.go index b80d2c6..f55d01a 100644 --- a/commit_test.go +++ b/commit_test.go @@ -5,6 +5,7 @@ import ( "time" "gopkg.in/src-d/go-git.v4/core" + "gopkg.in/src-d/go-git.v4/fixtures" . "gopkg.in/check.v1" ) @@ -131,6 +132,8 @@ func (s *SuiteCommit) TestString(c *C) { func (s *SuiteCommit) TestStringMultiLine(c *C) { hash := core.NewHash("e7d896db87294e33ca3202e536d4d9bb16023db3") + s.buildRepositories(c, fixtures.ByURL("https://github.com/src-d/go-git.git")) + commit, err := s.Repositories["https://github.com/src-d/go-git.git"].Commit(hash) c.Assert(err, IsNil) @@ -145,7 +148,6 @@ func (s *SuiteCommit) TestStringMultiLine(c *C) { " was getting invalid data on it read buffers.\n"+ "\n", ) - } func (s *SuiteCommit) TestCommitIterNext(c *C) { diff --git a/common_test.go b/common_test.go index d95ccf5..6281d0a 100644 --- a/common_test.go +++ b/common_test.go @@ -29,7 +29,9 @@ func (s *BaseSuite) SetUpSuite(c *C) { s.Suite.SetUpSuite(c) s.installMockProtocol(c) s.buildRepository(c) - s.buildRepositories(c) + + s.Repositories = make(map[string]*Repository, 0) + s.buildRepositories(c, fixtures.Basic()) } func (s *BaseSuite) installMockProtocol(c *C) { @@ -46,9 +48,8 @@ func (s *BaseSuite) buildRepository(c *C) { c.Assert(err, IsNil) } -func (s *BaseSuite) buildRepositories(c *C) { - s.Repositories = make(map[string]*Repository, 0) - for _, fixture := range fixtures.All() { +func (s *BaseSuite) buildRepositories(c *C, f fixtures.Fixtures) { + for _, fixture := range f { r := NewMemoryRepository() f := fixture.Packfile() diff --git a/file_test.go b/file_test.go index 28449dd..01ad8ca 100644 --- a/file_test.go +++ b/file_test.go @@ -4,6 +4,7 @@ import ( "io" "gopkg.in/src-d/go-git.v4/core" + "gopkg.in/src-d/go-git.v4/fixtures" . "gopkg.in/check.v1" ) @@ -179,6 +180,8 @@ var ignoreEmptyDirEntriesTests = []struct { // At least this test has a high chance of panicking if // we don't ignore empty dirs. func (s *FileSuite) TestIgnoreEmptyDirEntries(c *C) { + s.buildRepositories(c, fixtures.ByTag("empty-folder")) + for i, t := range ignoreEmptyDirEntriesTests { commit, err := s.Repositories[t.repo].Commit(core.NewHash(t.commit)) c.Assert(err, IsNil, Commentf("subtest %d: %v (%s)", i, err, t.commit)) diff --git a/fixtures/fixtures.go b/fixtures/fixtures.go index f027ffa..72b4f1c 100644 --- a/fixtures/fixtures.go +++ b/fixtures/fixtures.go @@ -67,6 +67,34 @@ var fixtures = Fixtures{{ URL: "https://github.com/cpcs499/Final_Pres_P.git", Head: core.NewHash("70bade703ce556c2c7391a8065c45c943e8b6bc3"), PackfileHash: core.NewHash("29f304662fd64f102d94722cf5bd8802d9a9472c"), +}, { + Tags: []string{"packfile", "diff-tree"}, + URL: "https://github.com/github/gem-builder.git", + PackfileHash: core.NewHash("1ea0b3971fd64fdcdf3282bfb58e8cf10095e4e6"), +}, { + Tags: []string{"packfile", "diff-tree"}, + URL: "https://github.com/githubtraining/example-branches.git", + PackfileHash: core.NewHash("bb8ee94710d3fa39379a630f76812c187217b312"), +}, { + Tags: []string{"packfile", "diff-tree"}, + URL: "https://github.com/rumpkernel/rumprun-xen.git", + PackfileHash: core.NewHash("7861f2632868833a35fe5e4ab94f99638ec5129b"), +}, { + Tags: []string{"packfile", "diff-tree"}, + URL: "https://github.com/mcuadros/skeetr.git", + PackfileHash: core.NewHash("36ef7a2296bfd526020340d27c5e1faa805d8d38"), +}, { + Tags: []string{"packfile", "diff-tree"}, + URL: "https://github.com/dezfowler/LiteMock.git", + PackfileHash: core.NewHash("0d9b6cfc261785837939aaede5986d7a7c212518"), +}, { + Tags: []string{"packfile", "diff-tree"}, + URL: "https://github.com/tyba/storable.git", + PackfileHash: core.NewHash("0d3d824fb5c930e7e7e1f0f399f2976847d31fd3"), +}, { + Tags: []string{"packfile", "diff-tree"}, + URL: "https://github.com/toqueteos/ts3.git", + PackfileHash: core.NewHash("21b33a26eb7ffbd35261149fe5d886b9debab7cb"), }} func All() Fixtures { diff --git a/references_test.go b/references_test.go index a119a7f..65eb56d 100644 --- a/references_test.go +++ b/references_test.go @@ -5,6 +5,7 @@ import ( "fmt" "gopkg.in/src-d/go-git.v4/core" + "gopkg.in/src-d/go-git.v4/fixtures" . "gopkg.in/check.v1" ) @@ -285,6 +286,11 @@ var referencesTests = [...]struct { */ } +func (s *ReferencesSuite) SetUpSuite(c *C) { + s.BaseSuite.SetUpSuite(c) + s.buildRepositories(c, fixtures.All()) +} + func (s *ReferencesSuite) TestRevList(c *C) { for _, t := range referencesTests { repo, ok := s.Repositories[t.repo] diff --git a/tag_test.go b/tag_test.go index be2d976..df3092b 100644 --- a/tag_test.go +++ b/tag_test.go @@ -5,6 +5,7 @@ import ( . "gopkg.in/check.v1" "gopkg.in/src-d/go-git.v4/core" + "gopkg.in/src-d/go-git.v4/fixtures" ) type TagSuite struct { @@ -13,6 +14,11 @@ type TagSuite struct { var _ = Suite(&TagSuite{}) +func (s *TagSuite) SetUpSuite(c *C) { + s.BaseSuite.SetUpSuite(c) + s.buildRepositories(c, fixtures.ByTag("tags")) +} + func (s *TagSuite) TestName(c *C) { r := s.Repositories["https://github.com/git-fixtures/tags.git"] diff --git a/tree_diff_test.go b/tree_diff_test.go index 44f6910..58f0a29 100644 --- a/tree_diff_test.go +++ b/tree_diff_test.go @@ -1,61 +1,23 @@ package git import ( - "os" "sort" "gopkg.in/src-d/go-git.v4/core" - "gopkg.in/src-d/go-git.v4/formats/packfile" + "gopkg.in/src-d/go-git.v4/fixtures" . "gopkg.in/check.v1" ) type DiffTreeSuite struct { BaseSuite - - repos map[string]*Repository } var _ = Suite(&DiffTreeSuite{}) func (s *DiffTreeSuite) SetUpSuite(c *C) { s.BaseSuite.SetUpSuite(c) - - fixtureRepos := [...]struct { - url string - packfile string - }{ - {"git://github.com/github/gem-builder.git", - "fixtures/pack-1ea0b3971fd64fdcdf3282bfb58e8cf10095e4e6.pack"}, - {"git://github.com/githubtraining/example-branches.git", - "fixtures/pack-bb8ee94710d3fa39379a630f76812c187217b312.pack"}, - {"git://github.com/rumpkernel/rumprun-xen.git", - "fixtures/pack-7861f2632868833a35fe5e4ab94f99638ec5129b.pack"}, - {"git://github.com/mcuadros/skeetr.git", - "fixtures/pack-36ef7a2296bfd526020340d27c5e1faa805d8d38.pack"}, - {"git://github.com/dezfowler/LiteMock.git", - "fixtures/pack-0d9b6cfc261785837939aaede5986d7a7c212518.pack"}, - {"git://github.com/tyba/storable.git", - "fixtures/pack-0d3d824fb5c930e7e7e1f0f399f2976847d31fd3.pack"}, - {"git://github.com/toqueteos/ts3.git", - "fixtures/pack-21b33a26eb7ffbd35261149fe5d886b9debab7cb.pack"}, - } - - s.repos = make(map[string]*Repository, 0) - for _, fixRepo := range fixtureRepos { - s.repos[fixRepo.url] = NewMemoryRepository() - - f, err := os.Open(fixRepo.packfile) - c.Assert(err, IsNil) - - r := packfile.NewScanner(f) - d, err := packfile.NewDecoder(r, s.repos[fixRepo.url].s.ObjectStorage()) - c.Assert(err, IsNil) - _, err = d.Decode() - c.Assert(err, IsNil) - - c.Assert(f.Close(), IsNil) - } + s.buildRepositories(c, fixtures.ByTag("diff-tree")) } func (s *DiffTreeSuite) TestActionString(c *C) { @@ -173,19 +135,19 @@ func (s *DiffTreeSuite) TestDiffTree(c *C) { expected []expectChange // the expected list of []changeExpect }{ { - "git://github.com/dezfowler/LiteMock.git", + "https://github.com/dezfowler/LiteMock.git", "", "", []expectChange{}, }, { - "git://github.com/dezfowler/LiteMock.git", + "https://github.com/dezfowler/LiteMock.git", "b7965eaa2c4f245d07191fe0bcfe86da032d672a", "b7965eaa2c4f245d07191fe0bcfe86da032d672a", []expectChange{}, }, { - "git://github.com/dezfowler/LiteMock.git", + "https://github.com/dezfowler/LiteMock.git", "", "b7965eaa2c4f245d07191fe0bcfe86da032d672a", []expectChange{ @@ -193,7 +155,7 @@ func (s *DiffTreeSuite) TestDiffTree(c *C) { }, }, { - "git://github.com/dezfowler/LiteMock.git", + "https://github.com/dezfowler/LiteMock.git", "b7965eaa2c4f245d07191fe0bcfe86da032d672a", "", []expectChange{ @@ -201,7 +163,7 @@ func (s *DiffTreeSuite) TestDiffTree(c *C) { }, }, { - "git://github.com/githubtraining/example-branches.git", + "https://github.com/githubtraining/example-branches.git", "", "f0eb272cc8f77803478c6748103a1450aa1abd37", []expectChange{ @@ -209,7 +171,7 @@ func (s *DiffTreeSuite) TestDiffTree(c *C) { }, }, { - "git://github.com/githubtraining/example-branches.git", + "https://github.com/githubtraining/example-branches.git", "f0eb272cc8f77803478c6748103a1450aa1abd37", "", []expectChange{ @@ -217,13 +179,13 @@ func (s *DiffTreeSuite) TestDiffTree(c *C) { }, }, { - "git://github.com/githubtraining/example-branches.git", + "https://github.com/githubtraining/example-branches.git", "f0eb272cc8f77803478c6748103a1450aa1abd37", "f0eb272cc8f77803478c6748103a1450aa1abd37", []expectChange{}, }, { - "git://github.com/github/gem-builder.git", + "https://github.com/github/gem-builder.git", "", "9608eed92b3839b06ebf72d5043da547de10ce85", []expectChange{ @@ -233,7 +195,7 @@ func (s *DiffTreeSuite) TestDiffTree(c *C) { }, }, { - "git://github.com/github/gem-builder.git", + "https://github.com/github/gem-builder.git", "9608eed92b3839b06ebf72d5043da547de10ce85", "", []expectChange{ @@ -243,13 +205,13 @@ func (s *DiffTreeSuite) TestDiffTree(c *C) { }, }, { - "git://github.com/github/gem-builder.git", + "https://github.com/github/gem-builder.git", "9608eed92b3839b06ebf72d5043da547de10ce85", "9608eed92b3839b06ebf72d5043da547de10ce85", []expectChange{}, }, { - "git://github.com/toqueteos/ts3.git", + "https://github.com/toqueteos/ts3.git", "", "764e914b75d6d6df1fc5d832aa9840f590abf1bb", []expectChange{ @@ -261,7 +223,7 @@ func (s *DiffTreeSuite) TestDiffTree(c *C) { }, }, { - "git://github.com/toqueteos/ts3.git", + "https://github.com/toqueteos/ts3.git", "764e914b75d6d6df1fc5d832aa9840f590abf1bb", "", []expectChange{ @@ -273,13 +235,13 @@ func (s *DiffTreeSuite) TestDiffTree(c *C) { }, }, { - "git://github.com/toqueteos/ts3.git", + "https://github.com/toqueteos/ts3.git", "764e914b75d6d6df1fc5d832aa9840f590abf1bb", "764e914b75d6d6df1fc5d832aa9840f590abf1bb", []expectChange{}, }, { - "git://github.com/github/gem-builder.git", + "https://github.com/github/gem-builder.git", "9608eed92b3839b06ebf72d5043da547de10ce85", "6c41e05a17e19805879689414026eb4e279f7de0", []expectChange{ @@ -287,7 +249,7 @@ func (s *DiffTreeSuite) TestDiffTree(c *C) { }, }, { - "git://github.com/github/gem-builder.git", + "https://github.com/github/gem-builder.git", "6c41e05a17e19805879689414026eb4e279f7de0", "89be3aac2f178719c12953cc9eaa23441f8d9371", []expectChange{ @@ -298,7 +260,7 @@ func (s *DiffTreeSuite) TestDiffTree(c *C) { }, }, { - "git://github.com/github/gem-builder.git", + "https://github.com/github/gem-builder.git", "89be3aac2f178719c12953cc9eaa23441f8d9371", "597240b7da22d03ad555328f15abc480b820acc0", []expectChange{ @@ -306,7 +268,7 @@ func (s *DiffTreeSuite) TestDiffTree(c *C) { }, }, { - "git://github.com/github/gem-builder.git", + "https://github.com/github/gem-builder.git", "597240b7da22d03ad555328f15abc480b820acc0", "0260380e375d2dd0e1a8fcab15f91ce56dbe778e", []expectChange{ @@ -319,7 +281,7 @@ func (s *DiffTreeSuite) TestDiffTree(c *C) { }, }, { - "git://github.com/github/gem-builder.git", + "https://github.com/github/gem-builder.git", "0260380e375d2dd0e1a8fcab15f91ce56dbe778e", "597240b7da22d03ad555328f15abc480b820acc0", []expectChange{ @@ -332,7 +294,7 @@ func (s *DiffTreeSuite) TestDiffTree(c *C) { }, }, { - "git://github.com/github/gem-builder.git", + "https://github.com/github/gem-builder.git", "0260380e375d2dd0e1a8fcab15f91ce56dbe778e", "ca9fd470bacb6262eb4ca23ee48bb2f43711c1ff", []expectChange{ @@ -342,7 +304,7 @@ func (s *DiffTreeSuite) TestDiffTree(c *C) { }, }, { - "git://github.com/github/gem-builder.git", + "https://github.com/github/gem-builder.git", "fe3c86745f887c23a0d38c85cfd87ca957312f86", "b7e3f636febf7a0cd3ab473b6d30081786d2c5b6", []expectChange{ @@ -355,7 +317,7 @@ func (s *DiffTreeSuite) TestDiffTree(c *C) { }, }, { - "git://github.com/rumpkernel/rumprun-xen.git", + "https://github.com/rumpkernel/rumprun-xen.git", "1831e47b0c6db750714cd0e4be97b5af17fb1eb0", "51d8515578ea0c88cc8fc1a057903675cf1fc16c", []expectChange{ @@ -366,7 +328,7 @@ func (s *DiffTreeSuite) TestDiffTree(c *C) { }, }, { - "git://github.com/rumpkernel/rumprun-xen.git", + "https://github.com/rumpkernel/rumprun-xen.git", "1831e47b0c6db750714cd0e4be97b5af17fb1eb0", "e13e678f7ee9badd01b120889e0ec5fdc8ae3802", []expectChange{ @@ -374,7 +336,7 @@ func (s *DiffTreeSuite) TestDiffTree(c *C) { }, }, } { - repo, ok := s.repos[t.repo] + repo, ok := s.Repositories[t.repo] c.Assert(ok, Equals, true, Commentf("subtest %d: repo %s not found", i, t.repo)) |