diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2017-01-31 12:00:40 +0100 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2017-01-31 12:00:40 +0100 |
commit | 387683bbcf40ed48e0f1ad0884970712f9682b9e (patch) | |
tree | c13eee66eb19b4126d69543312efa12c7a7d389f /config/refspec_test.go | |
parent | f7da595e8aef658cd3dfed897b84ada2b0eac921 (diff) | |
download | go-git-387683bbcf40ed48e0f1ad0884970712f9682b9e.tar.gz |
config: RefSpec.Validate returning errors and doc (Fixes #232)
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) { |