aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Cabrera <adc@toolazydogs.com>2018-03-14 09:33:54 -0700
committerAlan Cabrera <acabrera@nianticlabs.com>2018-03-14 09:35:15 -0700
commit87b70781ab9ff69811999396d76ca7dfdf6de24b (patch)
tree3a0b0927a4efc45c9e530162019e833278e8d049
parentd873056e03f21724f799824e02a17b2da7fd29af (diff)
downloadgo-git-87b70781ab9ff69811999396d76ca7dfdf6de24b.tar.gz
Add more unit tests for RefSpec
Need this to get better code coverage of the bug fix. Signed-off-by: Alan Cabrera <adc@toolazydogs.com>
-rw-r--r--config/refspec_test.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/config/refspec_test.go b/config/refspec_test.go
index 6daddb4..675e075 100644
--- a/config/refspec_test.go
+++ b/config/refspec_test.go
@@ -62,11 +62,17 @@ func (s *RefSpecSuite) TestRefSpecSrc(c *C) {
spec := RefSpec("refs/heads/*:refs/remotes/origin/*")
c.Assert(spec.Src(), Equals, "refs/heads/*")
+ spec = RefSpec("+refs/heads/*:refs/remotes/origin/*")
+ c.Assert(spec.Src(), Equals, "refs/heads/*")
+
spec = RefSpec(":refs/heads/master")
c.Assert(spec.Src(), Equals, "")
spec = RefSpec("refs/heads/love+hate:refs/heads/love+hate")
c.Assert(spec.Src(), Equals, "refs/heads/love+hate")
+
+ spec = RefSpec("+refs/heads/love+hate:refs/heads/love+hate")
+ c.Assert(spec.Src(), Equals, "refs/heads/love+hate")
}
func (s *RefSpecSuite) TestRefSpecMatch(c *C) {
@@ -74,12 +80,19 @@ func (s *RefSpecSuite) TestRefSpecMatch(c *C) {
c.Assert(spec.Match(plumbing.ReferenceName("refs/heads/foo")), Equals, false)
c.Assert(spec.Match(plumbing.ReferenceName("refs/heads/master")), Equals, true)
+ spec = RefSpec("+refs/heads/master:refs/remotes/origin/master")
+ c.Assert(spec.Match(plumbing.ReferenceName("refs/heads/foo")), Equals, false)
+ c.Assert(spec.Match(plumbing.ReferenceName("refs/heads/master")), Equals, true)
+
spec = RefSpec(":refs/heads/master")
c.Assert(spec.Match(plumbing.ReferenceName("")), Equals, true)
c.Assert(spec.Match(plumbing.ReferenceName("refs/heads/master")), Equals, false)
spec = RefSpec("refs/heads/love+hate:heads/love+hate")
c.Assert(spec.Match(plumbing.ReferenceName("refs/heads/love+hate")), Equals, true)
+
+ spec = RefSpec("+refs/heads/love+hate:heads/love+hate")
+ c.Assert(spec.Match(plumbing.ReferenceName("refs/heads/love+hate")), Equals, true)
}
func (s *RefSpecSuite) TestRefSpecMatchGlob(c *C) {