asset_test.go 612 B

123456789101112131415161718192021222324
  1. package update
  2. import (
  3. "reflect"
  4. "testing"
  5. )
  6. func TestAssetNamesFor(t *testing.T) {
  7. tests := []struct {
  8. goos string
  9. goarch string
  10. want []string
  11. }{
  12. {"linux", "amd64", []string{"vocat-linux-amd64"}},
  13. {"linux", "386", []string{"vocat-linux-386"}},
  14. {"linux", "arm64", []string{"vocat-linux-arm64"}},
  15. {"linux", "arm", []string{"vocat-linux-armv7", "vocat-linux-arm"}},
  16. }
  17. for _, item := range tests {
  18. if got := assetNamesFor(item.goos, item.goarch); !reflect.DeepEqual(got, item.want) {
  19. t.Errorf("assetNamesFor(%q, %q) = %#v, want %#v", item.goos, item.goarch, got, item.want)
  20. }
  21. }
  22. }