diff options
author | subtly <subtly@users.noreply.github.com> | 2015-06-04 22:55:59 +0800 |
---|---|---|
committer | subtly <subtly@users.noreply.github.com> | 2015-06-04 22:55:59 +0800 |
commit | 2afad75469658a45da547e3b78a652cc8c8ad728 (patch) | |
tree | f555ba9e1463cddf1d0750f8250968b946a51895 /libsolidity/SolidityABIJSON.cpp | |
parent | f9955c8ba10332f9c2a674ffdfc447895c15b01a (diff) | |
parent | 2f88fd6f5874a1f15135d443b5f05699ae971f18 (diff) | |
download | dexon-solidity-2afad75469658a45da547e3b78a652cc8c8ad728.tar dexon-solidity-2afad75469658a45da547e3b78a652cc8c8ad728.tar.gz dexon-solidity-2afad75469658a45da547e3b78a652cc8c8ad728.tar.bz2 dexon-solidity-2afad75469658a45da547e3b78a652cc8c8ad728.tar.lz dexon-solidity-2afad75469658a45da547e3b78a652cc8c8ad728.tar.xz dexon-solidity-2afad75469658a45da547e3b78a652cc8c8ad728.tar.zst dexon-solidity-2afad75469658a45da547e3b78a652cc8c8ad728.zip |
Merge branch 'develop' into whisper
Diffstat (limited to 'libsolidity/SolidityABIJSON.cpp')
-rw-r--r-- | libsolidity/SolidityABIJSON.cpp | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/libsolidity/SolidityABIJSON.cpp b/libsolidity/SolidityABIJSON.cpp index 26d0110b..f7390dc9 100644 --- a/libsolidity/SolidityABIJSON.cpp +++ b/libsolidity/SolidityABIJSON.cpp @@ -525,6 +525,76 @@ BOOST_AUTO_TEST_CASE(constructor_abi) checkInterface(sourceCode, interface); } + +BOOST_AUTO_TEST_CASE(return_param_in_abi) +{ + // bug #1801 + char const* sourceCode = R"( + contract test { + enum ActionChoices { GoLeft, GoRight, GoStraight, Sit } + function test(ActionChoices param) {} + function ret() returns(ActionChoices){ + ActionChoices action = ActionChoices.GoLeft; + return action; + } + } + )"; + + char const* interface = R"( + [ + { + "constant" : false, + "inputs" : [], + "name" : "ret", + "outputs" : [ + { + "name" : "", + "type" : "uint8" + } + ], + "type" : "function" + }, + { + "inputs": [ + { + "name": "param", + "type": "uint8" + } + ], + "type": "constructor" + } + ] + )"; + checkInterface(sourceCode, interface); +} + +BOOST_AUTO_TEST_CASE(strings_and_arrays) +{ + // bug #1801 + char const* sourceCode = R"( + contract test { + function f(string a, bytes b, uint[] c) external {} + } + )"; + + char const* interface = R"( + [ + { + "constant" : false, + "name": "f", + "inputs": [ + { "name": "a", "type": "string" }, + { "name": "b", "type": "bytes" }, + { "name": "c", "type": "uint256[]" } + ], + "outputs": [], + "type" : "function" + } + ] + )"; + checkInterface(sourceCode, interface); +} + BOOST_AUTO_TEST_SUITE_END() } |