MCPcopy
hub / github.com/git-lfs/git-lfs / TestCopyWithCallback

Function TestCopyWithCallback

tools/util_test.go:12–30  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestCopyWithCallback(t *testing.T) {
13 buf := bytes.NewBufferString("BOOYA")
14
15 called := 0
16 calledWritten := make([]int64, 0, 2)
17
18 n, err := CopyWithCallback(io.Discard, buf, 5, func(total int64, written int64, current int) error {
19 called += 1
20 calledWritten = append(calledWritten, written)
21 assert.Equal(t, 5, int(total))
22 return nil
23 })
24 assert.Nil(t, err)
25 assert.Equal(t, 5, int(n))
26
27 assert.Equal(t, 1, called)
28 assert.Len(t, calledWritten, 1)
29 assert.Equal(t, 5, int(calledWritten[0]))
30}
31
32func TestMethodExists(t *testing.T) {
33 // testing following methods exist in all platform.

Callers

nothing calls this directly

Calls 3

CopyWithCallbackFunction · 0.85
EqualMethod · 0.45
LenMethod · 0.45

Tested by

no test coverage detected