aboutsummaryrefslogtreecommitdiff
path: root/src/text/template/exec_test.go
diff options
context:
space:
mode:
authorMichal Bohuslávek <mbohuslavek@gmail.com>2018-08-23 19:51:50 +0200
committerBrad Fitzpatrick <bradfitz@golang.org>2018-08-23 19:24:40 +0000
commitb15a1e3cfb64aeeb90f74e0748524b38fde5ebf9 (patch)
treeb0ef0bfc73ca02151acbb7a153ed7b06dc405764 /src/text/template/exec_test.go
parent4b439e41e2cdd78e0eeed05942c93364c5d99b6b (diff)
downloadgo-b15a1e3cfb64aeeb90f74e0748524b38fde5ebf9.tar.xz
text/template: Put bad function name in quotes in panic from (*Template).Funcs
This turns panic: function name is not a valid identifier into panic: function name "" is not a valid identifier and also makes it consistent with the func signature check. This CL also makes the testBadFuncName func a test helper. Change-Id: Id967cb61ac28228de81e1cd76a39f5195a5ebd11 Reviewed-on: https://go-review.googlesource.com/130998 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/text/template/exec_test.go')
-rw-r--r--src/text/template/exec_test.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/text/template/exec_test.go b/src/text/template/exec_test.go
index 6f40d80635..648ad8ff03 100644
--- a/src/text/template/exec_test.go
+++ b/src/text/template/exec_test.go
@@ -1279,6 +1279,7 @@ func TestBadFuncNames(t *testing.T) {
}
func testBadFuncName(name string, t *testing.T) {
+ t.Helper()
defer func() {
recover()
}()