aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/SolidityABIJSON.cpp
diff options
context:
space:
mode:
authorsubtly <subtly@users.noreply.github.com>2015-06-04 22:55:59 +0800
committersubtly <subtly@users.noreply.github.com>2015-06-04 22:55:59 +0800
commit2afad75469658a45da547e3b78a652cc8c8ad728 (patch)
treef555ba9e1463cddf1d0750f8250968b946a51895 /libsolidity/SolidityABIJSON.cpp
parentf9955c8ba10332f9c2a674ffdfc447895c15b01a (diff)
parent2f88fd6f5874a1f15135d443b5f05699ae971f18 (diff)
downloaddexon-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.cpp70
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()
}