You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ntool/nfs/oper_write_test.go

27 lines
634 B
Go

1 year ago
package nfs_test
import (
"git.noahlan.cn/noahlan/ntool/nfs"
"git.noahlan.cn/noahlan/ntool/ntest/assert"
"testing"
)
func TestMustCopyFile(t *testing.T) {
srcPath := "./testdata/cp-file-src.txt"
dstPath := "./testdata/cp-file-dst.txt"
assert.NoErr(t, nfs.RmIfExist(srcPath))
assert.NoErr(t, nfs.RmFileIfExist(dstPath))
_, err := nfs.PutContents(srcPath, "hello")
assert.NoErr(t, err)
nfs.MustCopyFile(srcPath, dstPath)
assert.Eq(t, []byte("hello"), nfs.GetContents(dstPath))
assert.Eq(t, "hello", nfs.ReadString(dstPath))
str, err := nfs.ReadStringOrErr(dstPath)
assert.NoErr(t, err)
assert.Eq(t, "hello", str)
}