diff options
author | Bjørn Erik Pedersen <[email protected]> | 2018-02-22 09:15:12 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2018-02-22 09:15:12 +0100 |
commit | 0602135fd44b0cfa0a51b0ec6e451ae58ac95666 (patch) | |
tree | bb045df0360b26dbacf682fa227d5d4e18d57bdc /helpers/hugo_test.go | |
parent | 55bd46a633d68f62e131457631ba839d6f876a55 (diff) | |
download | hugo-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.go | 5 |
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()) } |