forked from quay/claircore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdater_test.go
50 lines (45 loc) · 847 Bytes
/
updater_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 aws
import (
"strings"
"testing"
"github.com/google/go-cmp/cmp"
"github.com/quay/claircore/aws/internal/alas"
)
func TestVersionString(t *testing.T) {
testcases := []struct {
pkg alas.Package
expected string
}{
{
pkg: alas.Package{
Epoch: "",
Version: "3.3.10",
Release: "26.amzn2",
},
expected: "3.3.10-26.amzn2",
},
{
pkg: alas.Package{
Epoch: "0",
Version: "3.3.10",
Release: "26.amzn2",
},
expected: "3.3.10-26.amzn2",
},
{
pkg: alas.Package{
Epoch: "10",
Version: "3.1.0",
Release: "8.amzn2.0.8",
},
expected: "10:3.1.0-8.amzn2.0.8",
},
}
var b strings.Builder
for _, testcase := range testcases {
v := versionString(&b, testcase.pkg)
if !cmp.Equal(v, testcase.expected) {
t.Errorf(cmp.Diff(v, testcase.expected))
}
}
}