(t *testing.T)
| 10 | ) |
| 11 | |
| 12 | func 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 | |
| 32 | func TestMethodExists(t *testing.T) { |
| 33 | // testing following methods exist in all platform. |
nothing calls this directly
no test coverage detected