Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Commit 87b7078

Browse files
maguroAlan Cabrera
authored andcommitted
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>
1 parent d873056 commit 87b7078

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

config/refspec_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,24 +62,37 @@ func (s *RefSpecSuite) TestRefSpecSrc(c *C) {
6262
spec := RefSpec("refs/heads/*:refs/remotes/origin/*")
6363
c.Assert(spec.Src(), Equals, "refs/heads/*")
6464

65+
spec = RefSpec("+refs/heads/*:refs/remotes/origin/*")
66+
c.Assert(spec.Src(), Equals, "refs/heads/*")
67+
6568
spec = RefSpec(":refs/heads/master")
6669
c.Assert(spec.Src(), Equals, "")
6770

6871
spec = RefSpec("refs/heads/love+hate:refs/heads/love+hate")
6972
c.Assert(spec.Src(), Equals, "refs/heads/love+hate")
73+
74+
spec = RefSpec("+refs/heads/love+hate:refs/heads/love+hate")
75+
c.Assert(spec.Src(), Equals, "refs/heads/love+hate")
7076
}
7177

7278
func (s *RefSpecSuite) TestRefSpecMatch(c *C) {
7379
spec := RefSpec("refs/heads/master:refs/remotes/origin/master")
7480
c.Assert(spec.Match(plumbing.ReferenceName("refs/heads/foo")), Equals, false)
7581
c.Assert(spec.Match(plumbing.ReferenceName("refs/heads/master")), Equals, true)
7682

83+
spec = RefSpec("+refs/heads/master:refs/remotes/origin/master")
84+
c.Assert(spec.Match(plumbing.ReferenceName("refs/heads/foo")), Equals, false)
85+
c.Assert(spec.Match(plumbing.ReferenceName("refs/heads/master")), Equals, true)
86+
7787
spec = RefSpec(":refs/heads/master")
7888
c.Assert(spec.Match(plumbing.ReferenceName("")), Equals, true)
7989
c.Assert(spec.Match(plumbing.ReferenceName("refs/heads/master")), Equals, false)
8090

8191
spec = RefSpec("refs/heads/love+hate:heads/love+hate")
8292
c.Assert(spec.Match(plumbing.ReferenceName("refs/heads/love+hate")), Equals, true)
93+
94+
spec = RefSpec("+refs/heads/love+hate:heads/love+hate")
95+
c.Assert(spec.Match(plumbing.ReferenceName("refs/heads/love+hate")), Equals, true)
8396
}
8497

8598
func (s *RefSpecSuite) TestRefSpecMatchGlob(c *C) {

0 commit comments

Comments
 (0)