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

Method TestParseAtWithValidExpression

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

Source from the content-addressed store, hash-verified

212}
213
214func (s *ParserSuite) TestParseAtWithValidExpression(c *C) {
215 tim, _ := time.Parse("2006-01-02T15:04:05Z", "2016-12-16T21:42:47Z")
216
217 datas := map[string]Revisioner{
218 "": Ref("HEAD"),
219 "{1}": AtReflog{1},
220 "{-1}": AtCheckout{1},
221 "{push}": AtPush{},
222 "{upstream}": AtUpstream{},
223 "{u}": AtUpstream{},
224 "{2016-12-16T21:42:47Z}": AtDate{tim},
225 }
226
227 for d, expected := range datas {
228 parser := NewParser(bytes.NewBufferString(d))
229
230 result, err := parser.parseAt()
231
232 c.Assert(err, Equals, nil)
233 c.Assert(result, DeepEquals, expected)
234 }
235}
236
237func (s *ParserSuite) TestParseAtWithInvalidExpression(c *C) {
238 datas := map[string]error{

Callers

nothing calls this directly

Calls 4

parseAtMethod · 0.95
RefTypeAlias · 0.85
NewParserFunction · 0.70
ParseMethod · 0.45

Tested by

no test coverage detected