-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgodeps_test.go
43 lines (39 loc) · 985 Bytes
/
godeps_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
package main
import (
"testing"
"github.com/stretchr/testify/assert"
)
func Test_mergeDeps(t *testing.T) {
tests := []struct {
name string
deps []Dependency
expectedDeps []Dependency
}{
{
name: "Simple",
deps: []Dependency{
Dependency{ImportPath: "github.com/enrichman/package_1/subpackage_1"},
},
expectedDeps: []Dependency{
Dependency{ImportPath: "github.com/enrichman/package_1"},
},
},
{
name: "Multiple",
deps: []Dependency{
Dependency{ImportPath: "github.com/enrichman/package_1/subpackage_1"},
Dependency{ImportPath: "github.com/enrichman/package_1/subpackage_2"},
Dependency{ImportPath: "github.com/enrichman/package_1/subpackage_3"},
},
expectedDeps: []Dependency{
Dependency{ImportPath: "github.com/enrichman/package_1"},
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
merged := mergeDeps(tt.deps)
assert.Equal(t, tt.expectedDeps, merged)
})
}
}