rlp: add support for "-" struct tag

This commit is contained in:
Felix Lange
2017-03-07 12:37:53 +01:00
parent 667cd518ce
commit eee96a5bb7
4 changed files with 31 additions and 7 deletions

View File

@ -339,6 +339,12 @@ var (
)
)
type hasIgnoredField struct {
A uint
B uint `rlp:"-"`
C uint
}
var decodeTests = []decodeTest{
// booleans
{input: "01", ptr: new(bool), value: true},
@ -490,6 +496,13 @@ var decodeTests = []decodeTest{
value: tailRaw{A: 1, Tail: []RawValue{}},
},
// struct tag "-"
{
input: "C20102",
ptr: new(hasIgnoredField),
value: hasIgnoredField{A: 1, C: 2},
},
// RawValue
{input: "01", ptr: new(RawValue), value: RawValue(unhex("01"))},
{input: "82FFFF", ptr: new(RawValue), value: RawValue(unhex("82FFFF"))},