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) }