diff options
author | Bjørn Erik Pedersen <[email protected]> | 2017-04-30 19:33:19 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2017-05-01 15:13:41 +0200 |
commit | a3bf118eaa0796892047bb7456fe89824e423f27 (patch) | |
tree | abe34c808992bc84e4fb6476c670ac246eca52c7 /tpl/compare/compare_test.go | |
parent | 656155736721547fef45466a28295f6a563cdd1f (diff) | |
download | hugo-a3bf118eaa0796892047bb7456fe89824e423f27.tar.gz hugo-a3bf118eaa0796892047bb7456fe89824e423f27.zip |
tpl/compare: Make it a package that stands on its own
See #3042
Diffstat (limited to 'tpl/compare/compare_test.go')
-rw-r--r-- | tpl/compare/compare_test.go | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/tpl/compare/compare_test.go b/tpl/compare/compare_test.go index d40a6fe5f..57f061f4d 100644 --- a/tpl/compare/compare_test.go +++ b/tpl/compare/compare_test.go @@ -46,6 +46,7 @@ func TestDefaultFunc(t *testing.T) { then := time.Now() now := time.Now() + ns := New() for i, test := range []struct { dflt interface{} @@ -91,7 +92,7 @@ func TestDefaultFunc(t *testing.T) { } { errMsg := fmt.Sprintf("[%d] %v", i, test) - result, err := Default(test.dflt, test.given) + result, err := ns.Default(test.dflt, test.given) require.NoError(t, err, errMsg) assert.Equal(t, result, test.expect, errMsg) @@ -101,16 +102,18 @@ func TestDefaultFunc(t *testing.T) { func TestCompare(t *testing.T) { t.Parallel() + n := New() + for _, test := range []struct { tstCompareType funcUnderTest func(a, b interface{}) bool }{ - {tstGt, Gt}, - {tstLt, Lt}, - {tstGe, Ge}, - {tstLe, Le}, - {tstEq, Eq}, - {tstNe, Ne}, + {tstGt, n.Gt}, + {tstLt, n.Lt}, + {tstGe, n.Ge}, + {tstLe, n.Le}, + {tstEq, n.Eq}, + {tstNe, n.Ne}, } { doTestCompare(t, test.tstCompareType, test.funcUnderTest) } |