diff options
Diffstat (limited to 'src/text/template/parse/parse_test.go')
| -rw-r--r-- | src/text/template/parse/parse_test.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/text/template/parse/parse_test.go b/src/text/template/parse/parse_test.go index 220f984777..c4585f6912 100644 --- a/src/text/template/parse/parse_test.go +++ b/src/text/template/parse/parse_test.go @@ -379,6 +379,22 @@ func TestParseWithComments(t *testing.T) { } } +func TestDeferFuncCheck(t *testing.T) { + oldTextFormat := textFormat + textFormat = "%q" + defer func() { textFormat = oldTextFormat }() + tr := New("defer func check") + tr.Mode = DeferFuncCheck + tmpl, err := tr.Parse("{{fn 1 2}}", "", "", make(map[string]*Tree)) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + expected := "{{fn 1 2}}" + if result := tmpl.Root.String(); result != expected { + t.Errorf("got\n\t%v\nexpected\n\t%v", result, expected) + } +} + type isEmptyTest struct { name string input string |
