common/hugo: Use official semver even for main releases

Closes #5639
This commit is contained in:
Bjørn Erik Pedersen 2019-02-01 09:44:12 +01:00
parent c7c66e664a
commit fab41f42d3
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F
2 changed files with 10 additions and 1 deletions

View file

@ -149,7 +149,7 @@ func BuildVersionString() string {
}
func version(version float32, patchVersion int, suffix string) string {
if patchVersion > 0 {
if patchVersion > 0 || version > 0.53 {
return fmt.Sprintf("%.2f.%d%s", version, patchVersion, suffix)
}
return fmt.Sprintf("%.2f%s", version, suffix)

View file

@ -35,6 +35,15 @@ func TestHugoVersion(t *testing.T) {
require.False(t, nextVersionString.Eq("0.21"))
require.True(t, nextVersionString.Eq(nextVersionString))
require.Equal(t, "0.20.3", v.NextPatchLevel(3).String())
// We started to use full semver versions even for main
// releases in v0.54.0
v = Version{Number: 0.53, PatchLevel: 0}
require.Equal(t, "0.53", v.String())
require.Equal(t, "0.54.0", v.Next().String())
require.Equal(t, "0.55.0", v.Next().Next().String())
v = Version{Number: 0.54, PatchLevel: 0, Suffix: "-DEV"}
require.Equal(t, "0.54.0-DEV", v.String())
}
func TestCompareVersions(t *testing.T) {