diff options
author | gary rong <garyrong0905@gmail.com> | 2019-01-23 21:36:49 +0800 |
---|---|---|
committer | Guillaume Ballet <gballet@gmail.com> | 2019-01-23 21:36:49 +0800 |
commit | a50b471b6b9c54eba795b74f6d74a09d531af9dc (patch) | |
tree | 6f461f269bafab8bdd13e8c8717c6774d67e9448 /accounts/abi/unpack_test.go | |
parent | ad849c01d3cde849dff60aa1fd4e13dd4a194ec6 (diff) | |
download | go-tangerine-a50b471b6b9c54eba795b74f6d74a09d531af9dc.tar go-tangerine-a50b471b6b9c54eba795b74f6d74a09d531af9dc.tar.gz go-tangerine-a50b471b6b9c54eba795b74f6d74a09d531af9dc.tar.bz2 go-tangerine-a50b471b6b9c54eba795b74f6d74a09d531af9dc.tar.lz go-tangerine-a50b471b6b9c54eba795b74f6d74a09d531af9dc.tar.xz go-tangerine-a50b471b6b9c54eba795b74f6d74a09d531af9dc.tar.zst go-tangerine-a50b471b6b9c54eba795b74f6d74a09d531af9dc.zip |
accounts/abi: allow interface as the destination (#18490)
Diffstat (limited to 'accounts/abi/unpack_test.go')
-rw-r--r-- | accounts/abi/unpack_test.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/accounts/abi/unpack_test.go b/accounts/abi/unpack_test.go index ff88be3d3..fa8a69d05 100644 --- a/accounts/abi/unpack_test.go +++ b/accounts/abi/unpack_test.go @@ -512,6 +512,11 @@ func TestMethodMultiReturn(t *testing.T) { Int *big.Int } + newInterfaceSlice := func(len int) interface{} { + slice := make([]interface{}, len) + return &slice + } + abi, data, expected := methodMultiReturn(require.New(t)) bigint := new(big.Int) var testCases = []struct { @@ -540,6 +545,16 @@ func TestMethodMultiReturn(t *testing.T) { "", "Can unpack into an array", }, { + &[2]interface{}{}, + &[2]interface{}{expected.Int, expected.String}, + "", + "Can unpack into interface array", + }, { + newInterfaceSlice(2), + &[]interface{}{expected.Int, expected.String}, + "", + "Can unpack into interface slice", + }, { &[]interface{}{new(int), new(int)}, &[]interface{}{&expected.Int, &expected.String}, "abi: cannot unmarshal *big.Int in to int", |