aboutsummaryrefslogtreecommitdiffstats
path: root/accounts/abi/unpack_test.go
diff options
context:
space:
mode:
authorgary rong <garyrong0905@gmail.com>2019-01-23 21:36:49 +0800
committerGuillaume Ballet <gballet@gmail.com>2019-01-23 21:36:49 +0800
commita50b471b6b9c54eba795b74f6d74a09d531af9dc (patch)
tree6f461f269bafab8bdd13e8c8717c6774d67e9448 /accounts/abi/unpack_test.go
parentad849c01d3cde849dff60aa1fd4e13dd4a194ec6 (diff)
downloadgo-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.go15
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",