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

Method TestParseRefWithValidName

internal/revision/parser_test.go:350–372  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

348}
349
350func (s *ParserSuite) TestParseRefWithValidName(c *C) {
351 datas := []string{
352 "lock",
353 "master",
354 "v1.0.0",
355 "refs/stash",
356 "refs/tags/v1.0.0",
357 "refs/heads/master",
358 "refs/remotes/test",
359 "refs/remotes/origin/HEAD",
360 "refs/remotes/origin/master",
361 "0123abcd", // short hash
362 }
363
364 for _, d := range datas {
365 parser := NewParser(bytes.NewBufferString(d))
366
367 result, err := parser.parseRef()
368
369 c.Assert(err, Equals, nil)
370 c.Assert(result, Equals, Ref(d))
371 }
372}
373
374func (s *ParserSuite) TestParseRefWithInvalidName(c *C) {
375 datas := map[string]error{

Callers

nothing calls this directly

Calls 3

parseRefMethod · 0.95
RefTypeAlias · 0.85
NewParserFunction · 0.70

Tested by

no test coverage detected