Commit d3866ddc authored by Rob Pike's avatar Rob Pike

template: fix trivial bug: integers are not "empty"

Fixes #1357.

R=adg, gri
CC=golang-dev
https://golang.org/cl/3809041
parent 8bfa9175
...@@ -673,7 +673,7 @@ func empty(v reflect.Value) bool { ...@@ -673,7 +673,7 @@ func empty(v reflect.Value) bool {
case *reflect.SliceValue: case *reflect.SliceValue:
return v.Len() == 0 return v.Len() == 0
} }
return true return false
} }
// Look up a variable or method, up through the parent if necessary. // Look up a variable or method, up through the parent if necessary.
......
...@@ -197,6 +197,12 @@ var tests = []*Test{ ...@@ -197,6 +197,12 @@ var tests = []*Test{
out: " Header\n", out: " Header\n",
}, },
&Test{
in: "{.section integer}{@}{.end}",
out: "77",
},
// Repeated // Repeated
&Test{ &Test{
in: "{.section pdata }\n" + in: "{.section pdata }\n" +
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment