summaryrefslogtreecommitdiffhomepage
path: root/helpers/hugo_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2018-02-22 09:15:12 +0100
committerBjørn Erik Pedersen <[email protected]>2018-02-22 09:15:12 +0100
commit0602135fd44b0cfa0a51b0ec6e451ae58ac95666 (patch)
treebb045df0360b26dbacf682fa227d5d4e18d57bdc /helpers/hugo_test.go
parent55bd46a633d68f62e131457631ba839d6f876a55 (diff)
downloadhugo-0602135fd44b0cfa0a51b0ec6e451ae58ac95666.tar.gz
hugo-0602135fd44b0cfa0a51b0ec6e451ae58ac95666.zip
Make ge, le etc. work with the Hugo Version number
This means that you can do something ala: ```html {{ if ge .Hugo.Version "0.36" }}Reasonable new Hugo version!{{ end }} ``` The intented use is feature toggling, but please note that it will take some time and Hugo versions until this can be trusted. It does not work in older Hugo versions. Fixes #4443
Diffstat (limited to 'helpers/hugo_test.go')
-rw-r--r--helpers/hugo_test.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/helpers/hugo_test.go b/helpers/hugo_test.go
index 1f5e5193f..78742c705 100644
--- a/helpers/hugo_test.go
+++ b/helpers/hugo_test.go
@@ -29,6 +29,11 @@ func TestHugoVersion(t *testing.T) {
require.Equal(t, v.ReleaseVersion().String(), "0.21")
require.Equal(t, "0.21-DEV", v.String())
require.Equal(t, "0.22", v.Next().String())
+ nextVersionString := v.Next().Version()
+ require.Equal(t, "0.22", nextVersionString.String())
+ require.True(t, nextVersionString.Eq("0.22"))
+ require.False(t, nextVersionString.Eq("0.21"))
+ require.True(t, nextVersionString.Eq(nextVersionString))
require.Equal(t, "0.20.3", v.NextPatchLevel(3).String())
}