aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/hex/hex_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/encoding/hex/hex_test.go')
-rw-r--r--src/encoding/hex/hex_test.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/encoding/hex/hex_test.go b/src/encoding/hex/hex_test.go
index f222316649..6ba054ef9a 100644
--- a/src/encoding/hex/hex_test.go
+++ b/src/encoding/hex/hex_test.go
@@ -204,6 +204,19 @@ func TestDumper_doubleclose(t *testing.T) {
}
}
+func TestDumper_earlyclose(t *testing.T) {
+ var out bytes.Buffer
+ dumper := Dumper(&out)
+
+ dumper.Close()
+ dumper.Write([]byte(`gopher`))
+
+ expected := ""
+ if out.String() != expected {
+ t.Fatalf("got:\n%#v\nwant:\n%#v", out.String(), expected)
+ }
+}
+
func TestDump(t *testing.T) {
var in [40]byte
for i := range in {