mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-19 21:21:39 +02:00
Add tpl/site and tpl/hugo
This means that the current `.Site` and ´.Hugo` is available as a globals, so you can do `site.IsServer`, `hugo.Version` etc. Fixes #5470 Fixes #5467 Fixes #5503
This commit is contained in:
@@ -21,8 +21,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/gohugoio/hugo/helpers"
|
||||
|
||||
"github.com/gohugoio/hugo/common/hugo"
|
||||
"github.com/spf13/cast"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
@@ -173,17 +172,17 @@ func doTestCompare(t *testing.T, tp tstCompareType, funcUnderTest func(a, b inte
|
||||
{tstEqerType1("a"), tstEqerType2("a"), 0},
|
||||
{tstEqerType2("a"), tstEqerType1("a"), 0},
|
||||
{tstEqerType2("a"), tstEqerType1("b"), -1},
|
||||
{helpers.MustParseHugoVersion("0.32.1").Version(), helpers.MustParseHugoVersion("0.32").Version(), 1},
|
||||
{helpers.MustParseHugoVersion("0.35").Version(), helpers.MustParseHugoVersion("0.32").Version(), 1},
|
||||
{helpers.MustParseHugoVersion("0.36").Version(), helpers.MustParseHugoVersion("0.36").Version(), 0},
|
||||
{helpers.MustParseHugoVersion("0.32").Version(), helpers.MustParseHugoVersion("0.36").Version(), -1},
|
||||
{helpers.MustParseHugoVersion("0.32").Version(), "0.36", -1},
|
||||
{"0.36", helpers.MustParseHugoVersion("0.32").Version(), 1},
|
||||
{"0.36", helpers.MustParseHugoVersion("0.36").Version(), 0},
|
||||
{"0.37", helpers.MustParseHugoVersion("0.37-DEV").Version(), 1},
|
||||
{"0.37-DEV", helpers.MustParseHugoVersion("0.37").Version(), -1},
|
||||
{"0.36", helpers.MustParseHugoVersion("0.37-DEV").Version(), -1},
|
||||
{"0.37-DEV", helpers.MustParseHugoVersion("0.37-DEV").Version(), 0},
|
||||
{hugo.MustParseVersion("0.32.1").Version(), hugo.MustParseVersion("0.32").Version(), 1},
|
||||
{hugo.MustParseVersion("0.35").Version(), hugo.MustParseVersion("0.32").Version(), 1},
|
||||
{hugo.MustParseVersion("0.36").Version(), hugo.MustParseVersion("0.36").Version(), 0},
|
||||
{hugo.MustParseVersion("0.32").Version(), hugo.MustParseVersion("0.36").Version(), -1},
|
||||
{hugo.MustParseVersion("0.32").Version(), "0.36", -1},
|
||||
{"0.36", hugo.MustParseVersion("0.32").Version(), 1},
|
||||
{"0.36", hugo.MustParseVersion("0.36").Version(), 0},
|
||||
{"0.37", hugo.MustParseVersion("0.37-DEV").Version(), 1},
|
||||
{"0.37-DEV", hugo.MustParseVersion("0.37").Version(), -1},
|
||||
{"0.36", hugo.MustParseVersion("0.37-DEV").Version(), -1},
|
||||
{"0.37-DEV", hugo.MustParseVersion("0.37-DEV").Version(), 0},
|
||||
} {
|
||||
result := funcUnderTest(test.left, test.right)
|
||||
success := false
|
||||
|
Reference in New Issue
Block a user