rlp: add Flat

This commit is contained in:
Felix Lange
2015-02-11 19:28:56 +01:00
parent ddccea75e8
commit b94f85de22
2 changed files with 58 additions and 0 deletions

View File

@ -177,6 +177,15 @@ var encTests = []encTest{
{val: &recstruct{5, nil}, output: "C205C0"},
{val: &recstruct{5, &recstruct{4, &recstruct{3, nil}}}, output: "C605C404C203C0"},
// flat
{val: Flat(uint(1)), error: "rlp.Flat: uint did not encode as list"},
{val: Flat(simplestruct{A: 3, B: "foo"}), output: "0383666F6F"},
{
// value generates more list headers after the Flat
val: []interface{}{"foo", []uint{1, 2}, Flat([]uint{3, 4}), []uint{5, 6}, "bar"},
output: "D083666F6FC201020304C2050683626172",
},
// nil
{val: (*uint)(nil), output: "80"},
{val: (*string)(nil), output: "80"},