diff options
author | Ondřej Surý <ondrej@sury.org> | 2012-03-26 16:50:58 +0200 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2012-03-26 16:50:58 +0200 |
commit | 519725bb3c075ee2462c929f5997cb068e18466a (patch) | |
tree | 5b162e8488ad147a645048c073577821b4a2bee9 /src/pkg/html/template/escape_test.go | |
parent | 842623c5dd2819d980ca9c58048d6bc6ed82475f (diff) | |
download | golang-upstream-weekly/2012.03.22.tar.gz |
Imported Upstream version 2012.03.22upstream-weekly/2012.03.22
Diffstat (limited to 'src/pkg/html/template/escape_test.go')
-rw-r--r-- | src/pkg/html/template/escape_test.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/pkg/html/template/escape_test.go b/src/pkg/html/template/escape_test.go index 2bbb1b1bc..ce12c1795 100644 --- a/src/pkg/html/template/escape_test.go +++ b/src/pkg/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 |