aboutsummaryrefslogtreecommitdiffstats
path: root/rlp/encode_test.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-02-12 02:28:56 +0800
committerFelix Lange <fjl@twurst.com>2015-02-12 02:28:56 +0800
commitb94f85de22cd53b87872543c959064cd2043c40d (patch)
treeac432bed0900180e7952e4c84706801c6dbeb4e6 /rlp/encode_test.go
parentddccea75e8f4931689fdf6b57ec7159b65c0d3c5 (diff)
downloaddexon-b94f85de22cd53b87872543c959064cd2043c40d.tar.gz
dexon-b94f85de22cd53b87872543c959064cd2043c40d.tar.zst
dexon-b94f85de22cd53b87872543c959064cd2043c40d.zip
rlp: add Flat
Diffstat (limited to 'rlp/encode_test.go')
-rw-r--r--rlp/encode_test.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/rlp/encode_test.go b/rlp/encode_test.go
index 18b843737..9b3085658 100644
--- a/rlp/encode_test.go
+++ b/rlp/encode_test.go
@@ -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"},