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

Function sectionsExample

plumbing/format/pktline/scanner_test.go:223–240  ·  view source on GitHub ↗

returns nSection sections, each of them with nLines pkt-lines (not counting the flush-pkt: 0009 0.0\n 0009 0.1\n ... 0000 and so on

(c *C, nSections, nLines int)

Source from the content-addressed store, hash-verified

221// 0000
222// and so on
223func sectionsExample(c *C, nSections, nLines int) io.Reader {
224 var buf bytes.Buffer
225 e := pktline.NewEncoder(&buf)
226
227 for section := 0; section < nSections; section++ {
228 ss := []string{}
229 for line := 0; line < nLines; line++ {
230 line := fmt.Sprintf(" %d.%d\n", section, line)
231 ss = append(ss, line)
232 }
233 err := e.EncodeString(ss...)
234 c.Assert(err, IsNil)
235 err = e.Flush()
236 c.Assert(err, IsNil)
237 }
238
239 return &buf
240}

Callers 1

TestReadSomeSectionsMethod · 0.85

Calls 3

EncodeStringMethod · 0.95
FlushMethod · 0.95
NewEncoderFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…