MCPcopy Index your code
hub / github.com/go-git/go-git / TestRefSpecIsValid

Method TestRefSpecIsValid

config/refspec_test.go:16–46  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

14func Test(t *testing.T) { TestingT(t) }
15
16func (s *RefSpecSuite) TestRefSpecIsValid(c *C) {
17 spec := RefSpec("+refs/heads/*:refs/remotes/origin/*")
18 c.Assert(spec.Validate(), Equals, nil)
19
20 spec = RefSpec("refs/heads/*:refs/remotes/origin/")
21 c.Assert(spec.Validate(), Equals, ErrRefSpecMalformedWildcard)
22
23 spec = RefSpec("refs/heads/master:refs/remotes/origin/master")
24 c.Assert(spec.Validate(), Equals, nil)
25
26 spec = RefSpec(":refs/heads/master")
27 c.Assert(spec.Validate(), Equals, nil)
28
29 spec = RefSpec(":refs/heads/*")
30 c.Assert(spec.Validate(), Equals, ErrRefSpecMalformedWildcard)
31
32 spec = RefSpec(":*")
33 c.Assert(spec.Validate(), Equals, ErrRefSpecMalformedWildcard)
34
35 spec = RefSpec("refs/heads/*")
36 c.Assert(spec.Validate(), Equals, ErrRefSpecMalformedSeparator)
37
38 spec = RefSpec("refs/heads:")
39 c.Assert(spec.Validate(), Equals, ErrRefSpecMalformedSeparator)
40
41 spec = RefSpec("12039e008f9a4e3394f3f94f8ea897785cb09448:refs/heads/foo")
42 c.Assert(spec.Validate(), Equals, nil)
43
44 spec = RefSpec("12039e008f9a4e3394f3f94f8ea897785cb09448:refs/heads/*")
45 c.Assert(spec.Validate(), Equals, ErrRefSpecMalformedWildcard)
46}
47
48func (s *RefSpecSuite) TestRefSpecIsForceUpdate(c *C) {
49 spec := RefSpec("+refs/heads/*:refs/remotes/origin/*")

Callers

nothing calls this directly

Calls 2

RefSpecTypeAlias · 0.85
ValidateMethod · 0.45

Tested by

no test coverage detected