aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/text/template/exec_test.go
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2012-07-23 16:19:12 -0700
committerRob Pike <r@golang.org>2012-07-23 16:19:12 -0700
commitce274339a1ed46356f5322288f4ef878a06f0aab (patch)
tree8591d294c061ddc3ac632bbd72f13ade404f64c4 /src/pkg/text/template/exec_test.go
parent7b73251d3d1153485b7f78d53ce7cb86b1b4d762 (diff)
downloadgo-ce274339a1ed46356f5322288f4ef878a06f0aab.tar.xz
text/template: fix bug in map indexing
If the key is not present, return value of the type of the element not the type of the key. Also fix a test that should have caught this case. Fixes #3850. R=golang-dev, dsymonds CC=golang-dev https://golang.org/cl/6405078
Diffstat (limited to 'src/pkg/text/template/exec_test.go')
-rw-r--r--src/pkg/text/template/exec_test.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/pkg/text/template/exec_test.go b/src/pkg/text/template/exec_test.go
index c8a3013977..4efe2d1b38 100644
--- a/src/pkg/text/template/exec_test.go
+++ b/src/pkg/text/template/exec_test.go
@@ -390,7 +390,7 @@ var execTests = []execTest{
{"slice[WRONG]", "{{index .SI `hello`}}", "", tVal, false},
{"map[one]", "{{index .MSI `one`}}", "1", tVal, true},
{"map[two]", "{{index .MSI `two`}}", "2", tVal, true},
- {"map[NO]", "{{index .MSI `XXX`}}", "", tVal, true},
+ {"map[NO]", "{{index .MSI `XXX`}}", "0", tVal, true},
{"map[WRONG]", "{{index .MSI 10}}", "", tVal, false},
{"double index", "{{index .SMSI 1 `eleven`}}", "11", tVal, true},