-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpath_test.go
50 lines (47 loc) · 831 Bytes
/
path_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 pzip
import (
"path/filepath"
"testing"
)
func TestSkipPath_Skip(t *testing.T) {
tests := []struct {
path string
skip SkipPath
want bool
}{
{
path: "test.zip",
skip: SkipPath{
Includes: []string{"*.zip"},
},
want: false,
},
{
path: "test.zip",
skip: SkipPath{
Includes: []string{filepath.Join("**", "*.zip")},
},
want: false,
},
{
path: filepath.Join("1", "2", "test.zip"),
skip: SkipPath{
Includes: []string{"*.zip"},
},
want: true,
},
{
path: filepath.Join("1", "2", "test.zip"),
skip: SkipPath{
Includes: []string{filepath.Join("**", "*.zip")},
},
want: false,
},
}
for _, tt := range tests {
target := tt.skip.Skip(tt.path)
if target != tt.want {
t.Errorf("Skip(%v) = %v, want %v", tt.path, target, tt.want)
}
}
}