summaryrefslogtreecommitdiff
path: root/src/pkg/template/template_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/template/template_test.go')
-rw-r--r--src/pkg/template/template_test.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/pkg/template/template_test.go b/src/pkg/template/template_test.go
index 11996f609..5e73bc9f4 100644
--- a/src/pkg/template/template_test.go
+++ b/src/pkg/template/template_test.go
@@ -312,8 +312,8 @@ func TestAll(t *testing.T) {
t.Errorf("expected execute error %q, got %q", test.err, err.String());
}
}
- if string(buf.Bytes()) != test.out {
- t.Errorf("for %q: expected %q got %q", test.in, test.out, string(buf.Bytes()));
+ if buf.String() != test.out {
+ t.Errorf("for %q: expected %q got %q", test.in, test.out, buf.String());
}
}
}
@@ -328,7 +328,7 @@ func TestStringDriverType(t *testing.T) {
if err != nil {
t.Error("unexpected execute error:", err)
}
- s := string(b.Bytes());
+ s := b.String();
if s != "template: hello" {
t.Errorf("failed passing string as data: expected %q got %q", "template: hello", s)
}
@@ -344,7 +344,7 @@ func TestTwice(t *testing.T) {
if err != nil {
t.Error("unexpected parse error:", err)
}
- s := string(b.Bytes());
+ s := b.String();
text := "template: hello";
if s != text {
t.Errorf("failed passing string as data: expected %q got %q", text, s);
@@ -353,7 +353,7 @@ func TestTwice(t *testing.T) {
if err != nil {
t.Error("unexpected parse error:", err)
}
- s = string(b.Bytes());
+ s = b.String();
text += text;
if s != text {
t.Errorf("failed passing string as data: expected %q got %q", text, s);
@@ -386,7 +386,7 @@ func TestCustomDelims(t *testing.T) {
}
var b bytes.Buffer;
err = tmpl.Execute("hello", &b);
- s := string(b.Bytes());
+ s := b.String();
if s != "template: hello" + ldelim + rdelim {
t.Errorf("failed delim check(%q %q) %q got %q", ldelim, rdelim, text, s)
}
@@ -411,7 +411,7 @@ func TestVarIndirection(t *testing.T) {
t.Fatal("unexpected execute error:", err)
}
expect := fmt.Sprintf("%v", &t1); // output should be hex address of t1
- if string(buf.Bytes()) != expect {
- t.Errorf("for %q: expected %q got %q", input, expect, string(buf.Bytes()));
+ if buf.String() != expect {
+ t.Errorf("for %q: expected %q got %q", input, expect, buf.String());
}
}