forked from peak/s5cmd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rm_test.go
56 lines (52 loc) · 973 Bytes
/
rm_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
51
52
53
54
55
56
package command
import (
"testing"
)
func TestSourcesHaveSameType(t *testing.T) {
t.Parallel()
tests := []struct {
name string
sources []string
wantErr bool
}{
{
name: "error_if_local_and_remote_mixed",
sources: []string{
"s3://bucket/key",
"filename.txt",
},
wantErr: true,
},
{
name: "error_if_sources_have_bucket",
sources: []string{
"s3://bucket/key",
"s3://bucket",
},
wantErr: true,
},
{
name: "error_if_sources_have_s3_prefix",
sources: []string{
"s3://bucket/prefix/",
},
wantErr: true,
},
{
name: "success",
sources: []string{
"s3://bucket/prefix/filename.txt",
"s3://bucket/wildcard/*.txt",
},
},
}
for _, tc := range tests {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
if err := sourcesHaveSameType(tc.sources...); (err != nil) != tc.wantErr {
t.Errorf("checkSources() error = %v, wantErr %v", err, tc.wantErr)
}
})
}
}