File tree Expand file tree Collapse file tree 2 files changed +39
-4
lines changed Expand file tree Collapse file tree 2 files changed +39
-4
lines changed Original file line number Diff line number Diff line change 44 "errors"
55 "fmt"
66 "regexp"
7- "strings"
87)
98
109// Errors
1817)
1918
2019var (
21- stableVersion = regexp .MustCompile (`^\d+\.\d+(?:[a-z]+)?$` )
22- stableGitRef = regexp .MustCompile (`^emacs-(\d+\.\d+(?:[a-z]+)?)$` )
20+ stableVersion = regexp .MustCompile (`^\d+\.\d+(?:[a-z]+)?(-\d+)?$` )
21+ pretestVersion = regexp .MustCompile (`-pretest(-\d+)?$` )
22+ stableGitRef = regexp .MustCompile (`^emacs-(\d+\.\d+(?:[a-z]+)?)$` )
2323)
2424
2525func VersionToName (version string ) (string , error ) {
@@ -28,7 +28,7 @@ func VersionToName(version string) (string, error) {
2828 }
2929
3030 if stableVersion .MatchString (version ) ||
31- strings . HasSuffix (version , "-pretest" ) {
31+ pretestVersion . MatchString (version ) {
3232 return "Emacs-" + version , nil
3333 }
3434
Original file line number Diff line number Diff line change @@ -30,6 +30,27 @@ func TestVersionToName(t *testing.T) {
3030 },
3131 want : "Emacs.2021-07-01.1b88404.master" ,
3232 },
33+ {
34+ name : "nightly with variant" ,
35+ args : args {
36+ version : "2021-07-01.1b88404.master-1" ,
37+ },
38+ want : "Emacs.2021-07-01.1b88404.master-1" ,
39+ },
40+ {
41+ name : "pretest" ,
42+ args : args {
43+ version : "30.0.93-pretest" ,
44+ },
45+ want : "Emacs-30.0.93-pretest" ,
46+ },
47+ {
48+ name : "pretest with variant" ,
49+ args : args {
50+ version : "30.0.93-pretest-1" ,
51+ },
52+ want : "Emacs-30.0.93-pretest-1" ,
53+ },
3354 {
3455 name : "stable" ,
3556 args : args {
@@ -44,6 +65,20 @@ func TestVersionToName(t *testing.T) {
4465 },
4566 want : "Emacs-23.3b" ,
4667 },
68+ {
69+ name : "stable with variant" ,
70+ args : args {
71+ version : "23.3-1" ,
72+ },
73+ want : "Emacs-23.3-1" ,
74+ },
75+ {
76+ name : "stable with letter and variant" ,
77+ args : args {
78+ version : "23.3b-1" ,
79+ },
80+ want : "Emacs-23.3b-1" ,
81+ },
4782 }
4883 for _ , tt := range tests {
4984 t .Run (tt .name , func (t * testing.T ) {
You can’t perform that action at this time.
0 commit comments