Skip to content

Commit 5183df5

Browse files
committed
added error checks
1 parent ad6e0f6 commit 5183df5

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

lib_test.go

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ func TestBaseTemplateTranslationOnly(t *testing.T) {
2222
translations := getTestTranslations()
2323

2424
tpl := New(`<html>{{- T "t" -}}</html>`, template.FuncMap{})
25-
tpl.AddPage(`test`, ``, translations)
25+
err := tpl.AddPage(`test`, ``, translations)
26+
if err != nil {
27+
t.Fail()
28+
}
2629

2730
var tmp bytes.Buffer
2831
for _, l := range translations.Languages() {
@@ -46,7 +49,10 @@ func TestPageTranslationFunction(t *testing.T) {
4649
translations := getTestTranslations()
4750

4851
tpl := New(`<html>{{- template "content" .C -}}</html>`, template.FuncMap{})
49-
tpl.AddPage(`test`, `{{- T "t" -}}`, translations)
52+
err := tpl.AddPage(`test`, `{{- T "t" -}}`, translations)
53+
if err != nil {
54+
t.Fail()
55+
}
5056

5157
var tmp bytes.Buffer
5258
for _, l := range translations.Languages() {
@@ -72,7 +78,10 @@ func TestPageTranslationVariable(t *testing.T) {
7278
translations := getTestTranslations()
7379

7480
tpl := New(`<html>{{- template "content" .C -}}</html>`, template.FuncMap{})
75-
tpl.AddPage(`test`, `{{- .T -}}`, translations)
81+
err := tpl.AddPage(`test`, `{{- .T -}}`, translations)
82+
if err != nil {
83+
t.Fail()
84+
}
7685

7786
var tmp bytes.Buffer
7887
for _, l := range translations.Languages() {
@@ -104,7 +113,10 @@ func TestCache(t *testing.T) {
104113
translations := getTestTranslations()
105114

106115
tpl := New(`<html>{{- T "t" -}}</html>`, template.FuncMap{})
107-
tpl.AddPage(`test`, ``, translations)
116+
err := tpl.AddPage(`test`, ``, translations)
117+
if err != nil {
118+
t.Fail()
119+
}
108120

109121
var tmp bytes.Buffer
110122

@@ -131,7 +143,10 @@ func TestPageTokenTranslation(t *testing.T) {
131143
translations := getTestTranslations()
132144

133145
tpl := New(``, template.FuncMap{})
134-
tpl.AddPage(`test`, ``, translations)
146+
err := tpl.AddPage(`test`, ``, translations)
147+
if err != nil {
148+
t.Fail()
149+
}
135150

136151
for _, l := range translations.Languages() {
137152
actual := tpl.Translate(`test`, `t`, l)

0 commit comments

Comments
 (0)