-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy patharch_test.go
34 lines (30 loc) · 1 KB
/
arch_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
package selfupdate
import (
"fmt"
"testing"
"github.com/stretchr/testify/assert"
)
func TestAdditionalArch(t *testing.T) {
testData := []struct {
arch string
goarm uint8
universalArch string
expected []string
}{
{"arm64", 0, "", []string{"arm64"}},
{"arm64", 0, "all", []string{"arm64", "all"}},
{"arm", 8, "", []string{"arm"}}, // armv8 is called arm64 - this shouldn't happen
{"arm", 7, "", []string{"armv7", "armv6", "armv5", "arm"}},
{"arm", 6, "", []string{"armv6", "armv5", "arm"}},
{"arm", 5, "", []string{"armv5", "arm"}},
{"arm", 4, "", []string{"arm"}}, // go is not supporting below armv5
{"amd64", 0, "", []string{"amd64", "x86_64"}},
{"amd64", 0, "all", []string{"amd64", "x86_64", "all"}},
}
for _, testItem := range testData {
t.Run(fmt.Sprintf("%s-%d", testItem.arch, testItem.goarm), func(t *testing.T) {
result := getAdditionalArch(testItem.arch, testItem.goarm, testItem.universalArch)
assert.Equal(t, testItem.expected, result)
})
}
}