forked from rosedblabs/rosedb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfile_util_test.go
50 lines (40 loc) · 937 Bytes
/
file_util_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package utils
import (
"github.com/roseduan/rosedb/storage"
"os"
"testing"
)
func TestExist1(t *testing.T) {
t.Log(os.TempDir() + "ssds")
exist := Exist(os.TempDir() + "ssds")
t.Log(exist)
if err := os.MkdirAll(os.TempDir()+"abcd", storage.FilePerm); err != nil {
t.Error(err)
}
}
func TestExist2(t *testing.T) {
//目录是否存在
path := "/tmp/rosedb"
t.Log(Exist(path))
//文件是否存在
t.Log(Exist(path + "/000w000000.data"))
t.Log(os.TempDir())
}
func TestCopyFile(t *testing.T) {
//src := "/Users/roseduan/resources/books/skiplist cookbook.pdf"
//dst := "/Users/roseduan/resources/books/skiplist cookbook-bak.pdf"
//
//err := CopyFile(src, dst)
//if err != nil {
// t.Error(err)
//}
}
func TestCopyDir(t *testing.T) {
//src := "/Users/roseduan/resources/books-new"
//dst := "/Users/roseduan/resources/books-new2"
//
//err := CopyDir(src, dst)
//if err != nil {
// log.Fatal(err)
//}
}