mirror of
https://github.com/jimeh/build-emacs-for-macos.git
synced 2026-02-19 10:46:39 +00:00
Add support for naming release and builds accordingly when given a git
ref for a pretest (90 or above patch number) or release
candidate ("-rcX" at the end of the tag).
55 lines
1.0 KiB
Go
55 lines
1.0 KiB
Go
package repository
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestRepository_ReleaseURL(t *testing.T) {
|
|
type fields struct {
|
|
Type Type
|
|
Source string
|
|
}
|
|
type args struct {
|
|
releaseName string
|
|
}
|
|
tests := []struct {
|
|
name string
|
|
fields fields
|
|
args args
|
|
want string
|
|
}{
|
|
{
|
|
name: "empty name",
|
|
fields: fields{Type: GitHub, Source: "foo/bar"},
|
|
args: args{releaseName: ""},
|
|
want: "",
|
|
},
|
|
{
|
|
name: "GitHub, foo/bar, v1.0.0",
|
|
fields: fields{Type: GitHub, Source: "foo/bar"},
|
|
args: args{releaseName: "v1.0.0"},
|
|
want: "https://github.com/foo/bar/releases/tag/v1.0.0",
|
|
},
|
|
{
|
|
name: "Not GitHub, foo/bar, v1.0.0",
|
|
fields: fields{Type: Type("oops"), Source: "foo/bar"},
|
|
args: args{releaseName: "v1.0.0"},
|
|
want: "",
|
|
},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
repo := &Repository{
|
|
Type: tt.fields.Type,
|
|
Source: tt.fields.Source,
|
|
}
|
|
|
|
got := repo.ReleaseURL(tt.args.releaseName)
|
|
|
|
assert.Equal(t, tt.want, got)
|
|
})
|
|
}
|
|
}
|