all: Mac OS X is now called macOS

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4694
LGTM: imsodin
This commit is contained in:
Jakob Borg
2018-01-27 09:07:19 +00:00
parent e0931e201e
commit 050f9f8091
7 changed files with 65 additions and 16 deletions

View File

@@ -9,6 +9,7 @@
package upgrade
import (
"runtime"
"strings"
"testing"
)
@@ -100,7 +101,7 @@ func TestSelectedRelease(t *testing.T) {
Prerelease: strings.Contains(c, "-"),
Assets: []Asset{
// There must be a matching asset or it will not get selected
{Name: releaseName(c)},
{Name: releaseNames(c)[0]},
},
})
}
@@ -115,3 +116,40 @@ func TestSelectedRelease(t *testing.T) {
}
}
}
func TestSelectedReleaseMacOS(t *testing.T) {
if runtime.GOOS != "darwin" {
t.Skip("macOS only")
}
// The alterantives that we expect should work
assetNames := []string{
"syncthing-macos-amd64-v0.14.47.tar.gz",
"syncthing-macosx-amd64-v0.14.47.tar.gz",
}
for _, assetName := range assetNames {
// Provide one release with the given asset name
rels := []Release{
{
Tag: "v0.14.47",
Prerelease: false,
Assets: []Asset{
{Name: assetName},
},
},
}
// Check that it is selected and the asset is as epected
sel, err := SelectLatestRelease(rels, "v0.14.46", false)
if err != nil {
t.Fatal("Unexpected error:", err)
}
if sel.Tag != "v0.14.47" {
t.Error("wrong tag selected:", sel.Tag)
}
if sel.Assets[0].Name != assetName {
t.Error("wrong asset selected:", sel.Assets[0].Name)
}
}
}