diff options
Diffstat (limited to 'src/encoding/hex/hex_test.go')
| -rw-r--r-- | src/encoding/hex/hex_test.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/encoding/hex/hex_test.go b/src/encoding/hex/hex_test.go index 1eb169cdee..8d1ae70774 100644 --- a/src/encoding/hex/hex_test.go +++ b/src/encoding/hex/hex_test.go @@ -55,13 +55,16 @@ func TestDecode(t *testing.T) { } } -func TestDecode_tooFewDstBytes(t *testing.T) { +func TestDecodeDstTooSmall(t *testing.T) { dst := make([]byte, 1) src := []byte{'0', '1', '2', '3'} - _, err := Decode(dst, src) + n, err := Decode(dst, src) if err == nil { t.Errorf("expected Decode to return an error, but it returned none") } + if !bytes.Equal(dst[:n], []byte{0x01}) { + t.Errorf("output mismatch: got %x, want 01", dst[:n]) + } } func TestEncodeToString(t *testing.T) { |
