]> Cypherpunks repositories - gostls13.git/commitdiff
template: fix trivial bug: integers are not "empty"
authorRob Pike <r@golang.org>
Mon, 20 Dec 2010 21:36:47 +0000 (13:36 -0800)
committerRob Pike <r@golang.org>
Mon, 20 Dec 2010 21:36:47 +0000 (13:36 -0800)
Fixes #1357.

R=adg, gri
CC=golang-dev
https://golang.org/cl/3809041

src/pkg/template/template.go
src/pkg/template/template_test.go

index be5c59aed8874da3f5c16ffdf8e47e23a48e0d83..aa050776165d0f9c416b29e3c65ee1b46801448d 100644 (file)
@@ -673,7 +673,7 @@ func empty(v reflect.Value) bool {
        case *reflect.SliceValue:
                return v.Len() == 0
        }
-       return true
+       return false
 }
 
 // Look up a variable or method, up through the parent if necessary.
index 1c491e34ae6a2efe0712bc50d3e1e3e09db22a06..4075444a81230b8bd033bd7992c510de785be012 100644 (file)
@@ -197,6 +197,12 @@ var tests = []*Test{
                out: " Header\n",
        },
 
+       &Test{
+               in: "{.section integer}{@}{.end}",
+
+               out: "77",
+       },
+
        // Repeated
        &Test{
                in: "{.section pdata }\n" +