3 Star 12 Fork 2

Git工具集/git-lfs

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
util_test.go 841 Bytes
一键复制 编辑 原始数据 按行查看 历史
package tools
import (
"bytes"
"io"
"io/ioutil"
"os"
"testing"
"github.com/stretchr/testify/assert"
)
func TestCopyWithCallback(t *testing.T) {
buf := bytes.NewBufferString("BOOYA")
called := 0
calledWritten := make([]int64, 0, 2)
n, err := CopyWithCallback(ioutil.Discard, buf, 5, func(total int64, written int64, current int) error {
called += 1
calledWritten = append(calledWritten, written)
assert.Equal(t, 5, int(total))
return nil
})
assert.Nil(t, err)
assert.Equal(t, 5, int(n))
assert.Equal(t, 1, called)
assert.Len(t, calledWritten, 1)
assert.Equal(t, 5, int(calledWritten[0]))
}
func TestMethodExists(t *testing.T) {
// testing following methods exist in all platform.
_, _ = CheckCloneFileSupported(os.TempDir())
_, _ = CloneFile(io.Writer(nil), io.Reader(nil))
_, _ = CloneFileByPath("", "")
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/vcs-all-in-one/git-lfs.git
git@gitee.com:vcs-all-in-one/git-lfs.git
vcs-all-in-one
git-lfs
git-lfs
master

搜索帮助