diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2016-08-04 11:36:44 +0300 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2016-08-04 11:36:44 +0300 |
commit | 93f3a85bf8d13d0c8cb8844594c79a46d8bfa581 (patch) | |
tree | 59f288dc6a6cf3bb8228398339ee31cc77028374 /tpl | |
parent | 70544f9e62e5577d1daac1af8849739e4bef98ad (diff) |
Fix the time template func test
By making it not depend on the locale setup.
Diffstat (limited to 'tpl')
-rw-r--r-- | tpl/template_funcs_test.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tpl/template_funcs_test.go b/tpl/template_funcs_test.go index 6246bba0b..1a94adfc3 100644 --- a/tpl/template_funcs_test.go +++ b/tpl/template_funcs_test.go @@ -28,6 +28,8 @@ import ( "testing" "time" + "github.com/spf13/hugo/helpers" + "github.com/spf13/afero" "github.com/spf13/cast" "github.com/spf13/hugo/hugofs" @@ -136,7 +138,7 @@ sub: {{sub 3 2}} substr: {{substr "BatMan" 0 -3}} substr: {{substr "BatMan" 3 3}} title: {{title "Bat man"}} -time: {{ time "2015-01-21" }} +time: {{ (time "2015-01-21").Year }} trim: {{ trim "++Batman--" "+-" }} upper: {{upper "BatMan"}} urlize: {{ "Bat Man" | urlize }} @@ -200,7 +202,7 @@ sub: 1 substr: Bat substr: Man title: Bat Man -time: 2015-01-21T00:00:00Z +time: 2015 trim: Batman upper: BATMAN urlize: bat-man @@ -229,7 +231,9 @@ urlize: bat-man } if b.String() != expected { - t.Errorf("Got\n%q\nExpected\n%q", b.String(), expected) + sl1 := strings.Split(b.String(), "\n") + sl2 := strings.Split(expected, "\n") + t.Errorf("Diff:\n%q", helpers.DiffStringSlices(sl1, sl2)) } } |