-
Notifications
You must be signed in to change notification settings - Fork 0
/
manifest_test.go
41 lines (37 loc) · 1.01 KB
/
manifest_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 gvtunused
import "testing"
func TestListManifestDeps(t *testing.T) {
testCases := []struct {
desc string
manifestPath string
dependencies []string
}{
{
desc: "parse single-dependency manifest file",
manifestPath: "testdata/single.manifest",
dependencies: []string{"github.com/pkg/errors"},
}, {
desc: "parse multiple-dependency manifest file",
manifestPath: "testdata/multiple.manifest",
dependencies: []string{
"github.com/pkg/errors",
"github.com/gorilla/mux"},
},
}
for _, tC := range testCases {
t.Run(tC.desc, func(t *testing.T) {
deps, err := ListManifestDeps(tC.manifestPath)
if err != nil {
t.Fatalf("Unexpected error: %v", err)
}
if len(deps) != len(tC.dependencies) {
t.Fatalf("Expected %d dependencies, got: %d", len(tC.dependencies), len(deps))
}
for i, imp := range deps {
if tC.dependencies[i] != imp {
t.Errorf("Expected dependency #%d to be %s, got: %s", i, tC.dependencies[i], imp)
}
}
})
}
}