Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tpl
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2016-08-04 11:36:44 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2016-08-04 11:36:44 +0300
commit93f3a85bf8d13d0c8cb8844594c79a46d8bfa581 (patch)
tree59f288dc6a6cf3bb8228398339ee31cc77028374 /tpl
parent70544f9e62e5577d1daac1af8849739e4bef98ad (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.go10
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))
}
}