aboutsummaryrefslogtreecommitdiffstats
path: root/accounts/abi/bind/bind_test.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2016-03-25 21:09:06 +0800
committerPéter Szilágyi <peterke@gmail.com>2016-03-25 21:09:06 +0800
commit9b4a45f6e806e84105a74b14f63a44b179a74a0f (patch)
treebbf81cd7dd722c0e48b4087645bdfd11aae63d42 /accounts/abi/bind/bind_test.go
parentcfb3a8ea8f98ef5a31d9e4a84a66eb5857461a7b (diff)
downloaddexon-9b4a45f6e806e84105a74b14f63a44b179a74a0f.tar
dexon-9b4a45f6e806e84105a74b14f63a44b179a74a0f.tar.gz
dexon-9b4a45f6e806e84105a74b14f63a44b179a74a0f.tar.bz2
dexon-9b4a45f6e806e84105a74b14f63a44b179a74a0f.tar.lz
dexon-9b4a45f6e806e84105a74b14f63a44b179a74a0f.tar.xz
dexon-9b4a45f6e806e84105a74b14f63a44b179a74a0f.tar.zst
dexon-9b4a45f6e806e84105a74b14f63a44b179a74a0f.zip
accounts/abi/bind: fix double pointer in generated code
Diffstat (limited to 'accounts/abi/bind/bind_test.go')
-rw-r--r--accounts/abi/bind/bind_test.go32
1 files changed, 32 insertions, 0 deletions
diff --git a/accounts/abi/bind/bind_test.go b/accounts/abi/bind/bind_test.go
index c6ed7a630..abe60b22c 100644
--- a/accounts/abi/bind/bind_test.go
+++ b/accounts/abi/bind/bind_test.go
@@ -196,6 +196,38 @@ var bindTests = []struct {
}
`,
},
+ // Tests that tuples can be properly returned and deserialized
+ {
+ `Tupler`,
+ `
+ contract Tupler {
+ function tuple() returns (string a, int b, bytes32 c) {
+ return ("Hi", 1, sha3(""));
+ }
+ }
+ `,
+ `606060405260dc8060106000396000f3606060405260e060020a60003504633175aae28114601a575b005b600060605260c0604052600260809081527f486900000000000000000000000000000000000000000000000000000000000060a05260017fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47060e0829052610100819052606060c0908152600261012081905281906101409060a09080838184600060046012f1505081517fffff000000000000000000000000000000000000000000000000000000000000169091525050604051610160819003945092505050f3`,
+ `[{"constant":true,"inputs":[],"name":"tuple","outputs":[{"name":"a","type":"string"},{"name":"b","type":"int256"},{"name":"c","type":"bytes32"}],"type":"function"}]`,
+ `
+ // Generate a new random account and a funded simulator
+ key := crypto.NewKey(rand.Reader)
+ sim := backends.NewSimulatedBackend(core.GenesisAccount{Address: key.Address, Balance: big.NewInt(10000000000)})
+
+ // Convert the tester key to an authorized transactor for ease of use
+ auth := bind.NewKeyedTransactor(key)
+
+ // Deploy a tuple tester contract and execute a structured call on it
+ _, _, tupler, err := DeployTupler(auth, sim)
+ if err != nil {
+ t.Fatalf("Failed to deploy tupler contract: %v", err)
+ }
+ sim.Commit()
+
+ if _, err := tupler.Tuple(nil); err != nil {
+ t.Fatalf("Failed to call structure retriever: %v", err)
+ }
+ `,
+ },
}
// Tests that packages generated by the binder can be successfully compiled and