diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2016-08-19 17:42:13 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2016-08-19 17:42:13 +0200 |
commit | 1d56b98d9b02e20f7feea542c75746eab34fad63 (patch) | |
tree | 006e8c3ac5e40353032109a5259bb28c37751996 /core/reference_test.go | |
parent | b1d116c59f7656dc8d5ff7294ba8f8a82c51bfd1 (diff) | |
download | go-git-1d56b98d9b02e20f7feea542c75746eab34fad63.tar.gz |
Remote.Fetch base on RefSpec, improvement of the responsabilities separation
Diffstat (limited to 'core/reference_test.go')
-rw-r--r-- | core/reference_test.go | 62 |
1 files changed, 2 insertions, 60 deletions
diff --git a/core/reference_test.go b/core/reference_test.go index 3d5a9b2..b14f24c 100644 --- a/core/reference_test.go +++ b/core/reference_test.go @@ -14,11 +14,8 @@ const ( ExampleReferenceName ReferenceName = "refs/heads/v4" ) -func (s *ReferenceSuite) TestReferenceNameAsRemote(c *C) { - c.Assert( - ExampleReferenceName.AsRemote("foo").String(), - Equals, "refs/remotes/foo/v4", - ) +func (s *ReferenceSuite) TestReferenceNameShort(c *C) { + c.Assert(ExampleReferenceName.Short(), Equals, "v4") } func (s *ReferenceSuite) TestNewReferenceFromStrings(c *C) { @@ -121,58 +118,3 @@ func (s *ReferenceSuite) TestReferenceSliceIterForEachStop(c *C) { c.Assert(count, Equals, 1) } - -func (s *ReferenceSuite) TestRefSpecIsValid(c *C) { - spec := RefSpec("+refs/heads/*:refs/remotes/origin/*") - c.Assert(spec.IsValid(), Equals, true) - - spec = RefSpec("refs/heads/*:refs/remotes/origin/") - c.Assert(spec.IsValid(), Equals, false) - - spec = RefSpec("refs/heads/master:refs/remotes/origin/master") - c.Assert(spec.IsValid(), Equals, true) - - spec = RefSpec("refs/heads/*") - c.Assert(spec.IsValid(), Equals, false) -} - -func (s *ReferenceSuite) TestRefSpecIsForceUpdate(c *C) { - spec := RefSpec("+refs/heads/*:refs/remotes/origin/*") - c.Assert(spec.IsForceUpdate(), Equals, true) - - spec = RefSpec("refs/heads/*:refs/remotes/origin/*") - c.Assert(spec.IsForceUpdate(), Equals, false) -} - -func (s *ReferenceSuite) TestRefSpecSrc(c *C) { - spec := RefSpec("refs/heads/*:refs/remotes/origin/*") - c.Assert(spec.Src(), Equals, "refs/heads/*") -} - -func (s *ReferenceSuite) TestRefSpecMatch(c *C) { - spec := RefSpec("refs/heads/master:refs/remotes/origin/master") - c.Assert(spec.Match(ReferenceName("refs/heads/foo")), Equals, false) - c.Assert(spec.Match(ReferenceName("refs/heads/master")), Equals, true) -} - -func (s *ReferenceSuite) TestRefSpecMatchBlob(c *C) { - spec := RefSpec("refs/heads/*:refs/remotes/origin/*") - c.Assert(spec.Match(ReferenceName("refs/tag/foo")), Equals, false) - c.Assert(spec.Match(ReferenceName("refs/heads/foo")), Equals, true) -} - -func (s *ReferenceSuite) TestRefSpecDst(c *C) { - spec := RefSpec("refs/heads/master:refs/remotes/origin/master") - c.Assert( - spec.Dst(ReferenceName("refs/heads/master")).String(), Equals, - "refs/remotes/origin/master", - ) -} - -func (s *ReferenceSuite) TestRefSpecDstBlob(c *C) { - spec := RefSpec("refs/heads/*:refs/remotes/origin/*") - c.Assert( - spec.Dst(ReferenceName("refs/heads/foo")).String(), Equals, - "refs/remotes/origin/foo", - ) -} |