-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
filewalk_test.go
38 lines (36 loc) · 1.38 KB
/
filewalk_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
package filetrove
import (
"reflect"
"testing"
)
func TestCreateFileList(t *testing.T) {
type args struct {
rootDir string
}
tests := []struct {
name string
args args
want []string
want1 []string
wantErr bool
}{
{"testdata file list", args{"testdata"}, []string{"testdata/.hiddenfile",
"testdata/directory/A_PDF_File.pdf", "testdata/dublincore_ex.json", "testdata/emptyfile.txt", "testdata/images/screenshot_1.jpeg", "testdata/images/screenshot_1.jpeg_original", "testdata/images/screenshot_1.png", "testdata/images/screenshot_1.png_original", "testdata/images/screenshot_1.tiff", "testdata/images/screenshot_1.tiff_original", "testdata/noaccess.rtf", "testdata/noextension", "testdata/textfile.txt", "testdata/transparent.png", "testdata/white.jpg", "testdata/yara/testrule.yara"},
[]string{"testdata", "testdata/.hiddendir", "testdata/directory", "testdata/images", "testdata/yara"}, false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, got1, err := CreateFileList(tt.args.rootDir)
if (err != nil) != tt.wantErr {
t.Errorf("CreateFileList() error = %v, wantErr %v", err, tt.wantErr)
return
}
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("CreateFileList() got = %v, want %v", got, tt.want)
}
if !reflect.DeepEqual(got1, tt.want1) {
t.Errorf("CreateFileList() got1 = %v, want %v", got1, tt.want1)
}
})
}
}