MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / TestCopyFile

Function TestCopyFile

utils/path_test.go:28–50  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

26)
27
28func TestCopyFile(t *testing.T) {
29 Convey("copy file", t, func() {
30 bytes := []byte("abc")
31 defer os.Remove("testcopy")
32 defer os.Remove("testcopy2")
33 ioutil.WriteFile("testcopy", bytes, 0600)
34 CopyFile("testcopy", "testcopy2")
35 bytes2, _ := ioutil.ReadFile("testcopy2")
36 So(bytes2, ShouldResemble, bytes)
37
38 n, err := CopyFile("testcopy", "testcopy")
39 So(err, ShouldBeNil)
40 So(n, ShouldBeZeroValue)
41
42 n, err = CopyFile("/path/not/exist", "testcopy")
43 So(err, ShouldNotBeNil)
44 So(n, ShouldBeZeroValue)
45
46 n, err = CopyFile("testcopy", "/path/not/exist")
47 So(err, ShouldNotBeNil)
48 So(n, ShouldBeZeroValue)
49 })
50}
51
52func TestHomeDirExpand(t *testing.T) {
53 Convey("expand ~ dir", t, func() {

Callers

nothing calls this directly

Calls 2

CopyFileFunction · 0.85
RemoveMethod · 0.45

Tested by

no test coverage detected