diff options
Diffstat (limited to 'config/refspec_test.go')
-rw-r--r-- | config/refspec_test.go | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/config/refspec_test.go b/config/refspec_test.go index 6f97422..6672cd2 100644 --- a/config/refspec_test.go +++ b/config/refspec_test.go @@ -15,25 +15,28 @@ func Test(t *testing.T) { TestingT(t) } func (s *RefSpecSuite) TestRefSpecIsValid(c *C) { spec := RefSpec("+refs/heads/*:refs/remotes/origin/*") - c.Assert(spec.IsValid(), Equals, true) + c.Assert(spec.Validate(), Equals, nil) spec = RefSpec("refs/heads/*:refs/remotes/origin/") - c.Assert(spec.IsValid(), Equals, false) + c.Assert(spec.Validate(), Equals, ErrRefSpecMalformedWildcard) spec = RefSpec("refs/heads/master:refs/remotes/origin/master") - c.Assert(spec.IsValid(), Equals, true) + c.Assert(spec.Validate(), Equals, nil) spec = RefSpec(":refs/heads/master") - c.Assert(spec.IsValid(), Equals, true) + c.Assert(spec.Validate(), Equals, nil) spec = RefSpec(":refs/heads/*") - c.Assert(spec.IsValid(), Equals, false) + c.Assert(spec.Validate(), Equals, ErrRefSpecMalformedWildcard) spec = RefSpec(":*") - c.Assert(spec.IsValid(), Equals, false) + c.Assert(spec.Validate(), Equals, ErrRefSpecMalformedWildcard) spec = RefSpec("refs/heads/*") - c.Assert(spec.IsValid(), Equals, false) + c.Assert(spec.Validate(), Equals, ErrRefSpecMalformedSeparator) + + spec = RefSpec("refs/heads:") + c.Assert(spec.Validate(), Equals, ErrRefSpecMalformedSeparator) } func (s *RefSpecSuite) TestRefSpecIsForceUpdate(c *C) { |