diff options
| author | Rob Pike <r@golang.org> | 2014-10-18 11:22:05 -0700 |
|---|---|---|
| committer | Rob Pike <r@golang.org> | 2014-10-18 11:22:05 -0700 |
| commit | 1cd78eedd092c9ec10f1b5c626b8bcd0298e065f (patch) | |
| tree | 7b7b86bf926e9920533392bb16723c4d782c5c0d /src/text/template/exec_test.go | |
| parent | 65dde1ed4b1c71fad6d2b106b779c5191e5f7cd7 (diff) | |
| download | go-1cd78eedd092c9ec10f1b5c626b8bcd0298e065f.tar.xz | |
text/template: fix bug in pipelined variadics
Simple bug in argument processing: The final arg may
be the pipeline value, in which case it gets bound to the
fixed argument section. The code got that wrong. Easy
to fix.
Fixes #8950.
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/161750043
Diffstat (limited to 'src/text/template/exec_test.go')
| -rw-r--r-- | src/text/template/exec_test.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/text/template/exec_test.go b/src/text/template/exec_test.go index e2cf2d3705..69c213ed24 100644 --- a/src/text/template/exec_test.go +++ b/src/text/template/exec_test.go @@ -893,6 +893,18 @@ func TestMessageForExecuteEmpty(t *testing.T) { } } +func TestFinalForPrintf(t *testing.T) { + tmpl, err := New("").Parse(`{{"x" | printf}}`) + if err != nil { + t.Fatal(err) + } + var b bytes.Buffer + err = tmpl.Execute(&b, 0) + if err != nil { + t.Fatal(err) + } +} + type cmpTest struct { expr string truth string |
