From a829a5658723ff3681f14650818ef050cb0a7fa8 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Sat, 21 Mar 2015 00:49:31 +0100 Subject: rlp: add Stream.Raw --- rlp/decode_test.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'rlp/decode_test.go') diff --git a/rlp/decode_test.go b/rlp/decode_test.go index 0f034d5d8..a18ff1d08 100644 --- a/rlp/decode_test.go +++ b/rlp/decode_test.go @@ -165,6 +165,20 @@ func TestStreamList(t *testing.T) { } } +func TestStreamRaw(t *testing.T) { + s := NewStream(bytes.NewReader(unhex("C58401010101"))) + s.List() + + want := unhex("8401010101") + raw, err := s.Raw() + if err != nil { + t.Fatal(err) + } + if !bytes.Equal(want, raw) { + t.Errorf("raw mismatch: got %x, want %x", raw, want) + } +} + func TestDecodeErrors(t *testing.T) { r := bytes.NewReader(nil) @@ -331,7 +345,7 @@ var decodeTests = []decodeTest{ {input: "C109", ptr: new(*[]uint), value: &[]uint{9}}, {input: "C58403030303", ptr: new(*[][]byte), value: &[][]byte{{3, 3, 3, 3}}}, - // check that input position is advanced also empty values. + // check that input position is advanced also for empty values. {input: "C3808005", ptr: new([]*uint), value: []*uint{nil, nil, uintp(5)}}, // pointer should be reset to nil -- cgit v1.2.3