summaryrefslogtreecommitdiff
path: root/src/pkg/template/template_test.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2009-11-30 10:29:14 -0800
committerRuss Cox <rsc@golang.org>2009-11-30 10:29:14 -0800
commit12b2fc8a77ddcb0627796b340853da4988768dc2 (patch)
treebc64160dde6d6013710ec90b5b6642e11f49c50f /src/pkg/template/template_test.go
parent877e18afe2c8cec58ffd44f240eb45bb9e71119b (diff)
downloadgolang-12b2fc8a77ddcb0627796b340853da4988768dc2.tar.gz
template: two bug fixes / nits
* diagnose template not created with New (current code just crashes) * write []byte uninterpreted (current code writes fmt format: "[65 65 65 65]") R=r CC=golang-dev http://codereview.appspot.com/161075
Diffstat (limited to 'src/pkg/template/template_test.go')
-rw-r--r--src/pkg/template/template_test.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/pkg/template/template_test.go b/src/pkg/template/template_test.go
index 7384da9e5..379f0f342 100644
--- a/src/pkg/template/template_test.go
+++ b/src/pkg/template/template_test.go
@@ -9,6 +9,7 @@ import (
"container/vector";
"fmt";
"io";
+ "strings";
"testing";
)
@@ -41,6 +42,7 @@ type S struct {
false bool;
mp map[string]string;
innermap U;
+ bytes []byte;
}
var t1 = T{"ItemNumber1", "ValueNumber1"}
@@ -282,6 +284,12 @@ var tests = []*Test{
out: "1\n4\n",
},
+ &Test{
+ in: "{bytes}",
+
+ out: "hello",
+ },
+
// Maps
&Test{
@@ -317,6 +325,7 @@ func TestAll(t *testing.T) {
s.mp["mapkey"] = "Ahoy!";
s.innermap.mp = make(map[string]int);
s.innermap.mp["innerkey"] = 55;
+ s.bytes = strings.Bytes("hello");
var buf bytes.Buffer;
for _, test := range tests {