-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfedup_test.go
41 lines (38 loc) · 853 Bytes
/
fedup_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
package fedup_test
import (
"bytes"
"testing"
"github.com/jhuntwork/fedup"
"github.com/stretchr/testify/assert"
)
func TestDedup(t *testing.T) {
t.Parallel()
tests := []struct {
description string
directory string
errMsg string
}{
{
description: "Should fail when provided directory doesn't exist",
directory: "testdata/no_such_file",
errMsg: "testdata/no_such_file: no such file or directory",
},
{
description: "Should not fail when given a valid directory",
directory: "testdata",
},
}
for _, tc := range tests {
tc := tc
t.Run(tc.description, func(t *testing.T) {
t.Parallel()
assert := assert.New(t)
_, err := fedup.Dedup(tc.directory, true, &bytes.Buffer{})
if tc.errMsg != "" {
assert.Contains(err.Error(), tc.errMsg)
} else {
assert.NoError(err)
}
})
}
}