diff options
Diffstat (limited to 'libgo/go/html/template/escape_test.go')
-rw-r--r-- | libgo/go/html/template/escape_test.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libgo/go/html/template/escape_test.go b/libgo/go/html/template/escape_test.go index 2bbb1b1bc94..ce12c1795c2 100644 --- a/libgo/go/html/template/escape_test.go +++ b/libgo/go/html/template/escape_test.go @@ -8,6 +8,7 @@ import ( "bytes" "encoding/json" "fmt" + "os" "strings" "testing" "text/template" @@ -1637,6 +1638,14 @@ func TestIndirectPrint(t *testing.T) { } } +// This is a test for issue 3272. +func TestEmptyTemplate(t *testing.T) { + page := Must(New("page").ParseFiles(os.DevNull)) + if err := page.ExecuteTemplate(os.Stdout, "page", "nothing"); err == nil { + t.Fatal("expected error") + } +} + func BenchmarkEscapedExecute(b *testing.B) { tmpl := Must(New("t").Parse(`<a onclick="alert('{{.}}')">{{.}}</a>`)) var buf bytes.Buffer |