@ -310,6 +310,53 @@ var unpackTests = []unpackTest{
Int2 * big . Int
Int2 * big . Int
} { big . NewInt ( 1 ) , big . NewInt ( 2 ) } ,
} { big . NewInt ( 1 ) , big . NewInt ( 2 ) } ,
} ,
} ,
{
def : ` [ { "name":"int_one","type":"int256"}] ` ,
enc : "00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002" ,
want : struct {
IntOne * big . Int
} { big . NewInt ( 1 ) } ,
} ,
{
def : ` [ { "name":"int__one","type":"int256"}] ` ,
enc : "00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002" ,
want : struct {
IntOne * big . Int
} { big . NewInt ( 1 ) } ,
} ,
{
def : ` [ { "name":"int_one_","type":"int256"}] ` ,
enc : "00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002" ,
want : struct {
IntOne * big . Int
} { big . NewInt ( 1 ) } ,
} ,
{
def : ` [ { "name":"int_one","type":"int256"}, { "name":"intone","type":"int256"}] ` ,
enc : "00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002" ,
want : struct {
IntOne * big . Int
Intone * big . Int
} { big . NewInt ( 1 ) , big . NewInt ( 2 ) } ,
} ,
{
def : ` [ { "name":"___","type":"int256"}] ` ,
enc : "00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002" ,
want : struct {
IntOne * big . Int
Intone * big . Int
} { } ,
err : "abi: purely underscored output cannot unpack to struct" ,
} ,
{
def : ` [ { "name":"int_one","type":"int256"}, { "name":"IntOne","type":"int256"}] ` ,
enc : "00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002" ,
want : struct {
Int1 * big . Int
Int2 * big . Int
} { } ,
err : "abi: multiple outputs mapping to the same struct field 'IntOne'" ,
} ,
{
{
def : ` [ { "name":"int","type":"int256"}, { "name":"Int","type":"int256"}] ` ,
def : ` [ { "name":"int","type":"int256"}, { "name":"Int","type":"int256"}] ` ,
enc : "00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002" ,
enc : "00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002" ,