MCPcopy Create free account
hub / github.com/go-git/go-git / TestRefSpecMatchGlob

Method TestRefSpecMatchGlob

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

Source from the content-addressed store, hash-verified

110}
111
112func (s *RefSpecSuite) TestRefSpecMatchGlob(c *C) {
113 tests := map[string]map[string]bool{
114 "refs/heads/*:refs/remotes/origin/*": {
115 "refs/tag/foo": false,
116 "refs/heads/foo": true,
117 },
118 "refs/heads/*bc:refs/remotes/origin/*bc": {
119 "refs/heads/abc": true,
120 "refs/heads/bc": true,
121 "refs/heads/abx": false,
122 },
123 "refs/heads/a*c:refs/remotes/origin/a*c": {
124 "refs/heads/abc": true,
125 "refs/heads/ac": true,
126 "refs/heads/abx": false,
127 },
128 "refs/heads/ab*:refs/remotes/origin/ab*": {
129 "refs/heads/abc": true,
130 "refs/heads/ab": true,
131 "refs/heads/xbc": false,
132 },
133 }
134
135 for specStr, data := range tests {
136 spec := RefSpec(specStr)
137 for ref, matches := range data {
138 c.Assert(spec.Match(plumbing.ReferenceName(ref)),
139 Equals,
140 matches,
141 Commentf("while matching spec %q against ref %q", specStr, ref),
142 )
143 }
144 }
145}
146
147func (s *RefSpecSuite) TestRefSpecDst(c *C) {
148 spec := RefSpec("refs/heads/master:refs/remotes/origin/master")

Callers

nothing calls this directly

Calls 3

ReferenceNameTypeAlias · 0.92
RefSpecTypeAlias · 0.85
MatchMethod · 0.65

Tested by

no test coverage detected