github.com/creativeprojects/go-selfupdate@v1.2.0/arch_test.go (about)

     1  package selfupdate
     2  
     3  import (
     4  	"fmt"
     5  	"testing"
     6  
     7  	"github.com/stretchr/testify/assert"
     8  )
     9  
    10  func TestAdditionalArch(t *testing.T) {
    11  	testData := []struct {
    12  		arch     string
    13  		goarm    uint8
    14  		expected []string
    15  	}{
    16  		{"arm64", 8, []string{}},
    17  		{"arm", 8, []string{}}, // armv8 is called arm64 - this shouldn't happen
    18  		{"arm", 7, []string{"armv7", "armv6", "armv5"}},
    19  		{"arm", 6, []string{"armv6", "armv5"}},
    20  		{"arm", 5, []string{"armv5"}},
    21  		{"arm", 4, []string{}}, // go is not supporting below armv5
    22  		{"amd64", 0, []string{"x86_64"}},
    23  	}
    24  
    25  	for _, testItem := range testData {
    26  		t.Run(fmt.Sprintf("%s-%d", testItem.arch, testItem.goarm), func(t *testing.T) {
    27  			result := generateAdditionalArch(testItem.arch, testItem.goarm)
    28  			assert.ElementsMatch(t, testItem.expected, result)
    29  		})
    30  	}
    31  }