mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
parent
c7c66e664a
commit
fab41f42d3
2 changed files with 10 additions and 1 deletions
|
@ -149,7 +149,7 @@ func BuildVersionString() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func version(version float32, patchVersion int, suffix string) 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.%d%s", version, patchVersion, suffix)
|
||||||
}
|
}
|
||||||
return fmt.Sprintf("%.2f%s", version, suffix)
|
return fmt.Sprintf("%.2f%s", version, suffix)
|
||||||
|
|
|
@ -35,6 +35,15 @@ func TestHugoVersion(t *testing.T) {
|
||||||
require.False(t, nextVersionString.Eq("0.21"))
|
require.False(t, nextVersionString.Eq("0.21"))
|
||||||
require.True(t, nextVersionString.Eq(nextVersionString))
|
require.True(t, nextVersionString.Eq(nextVersionString))
|
||||||
require.Equal(t, "0.20.3", v.NextPatchLevel(3).String())
|
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) {
|
func TestCompareVersions(t *testing.T) {
|
||||||
|
|
Loading…
Reference in a new issue