aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-06-30 16:22:35 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-09-16 19:12:44 +0800
commit7e1b9c16528b08a8924f85c57f3b08b6cec70584 (patch)
tree7deaed3488dbff3c6b6d944d4aafe3177698beaa /test
parent36a90289e65b06c54326a1c254baa5fa6029f766 (diff)
downloaddexon-solidity-7e1b9c16528b08a8924f85c57f3b08b6cec70584.tar.gz
dexon-solidity-7e1b9c16528b08a8924f85c57f3b08b6cec70584.tar.zst
dexon-solidity-7e1b9c16528b08a8924f85c57f3b08b6cec70584.zip
Structure type json using "components".
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/SolidityABIJSON.cpp249
1 files changed, 143 insertions, 106 deletions
diff --git a/test/libsolidity/SolidityABIJSON.cpp b/test/libsolidity/SolidityABIJSON.cpp
index 3de8b732..5ddd28ad 100644
--- a/test/libsolidity/SolidityABIJSON.cpp
+++ b/test/libsolidity/SolidityABIJSON.cpp
@@ -950,32 +950,39 @@ BOOST_AUTO_TEST_CASE(return_structs)
}
)";
char const* interface = R"(
- [
- {
+ [{
"constant" : false,
- "payable": false,
- "inputs": [],
- "name": "f",
- "outputs": [{
- "name": "x",
- "type": "uint256"
- }, {
- "name": "s",
- "type": [{
- "name": "a",
- "type": "uint256"
- }, {
- "name": "sub",
- "subtype": [{
- "name": "x",
- "type": "uint256[2]"
- }],
- "type": "[]"
- }]
- }],
+ "inputs" : [],
+ "name" : "f",
+ "outputs" : [
+ {
+ "name" : "x",
+ "type" : "uint256"
+ },
+ {
+ "components" : [
+ {
+ "name" : "a",
+ "type" : "uint256"
+ },
+ {
+ "components" : [
+ {
+ "name" : "x",
+ "type" : "uint256[2]"
+ }
+ ],
+ "name" : "sub",
+ "type" : "[]"
+ }
+ ],
+ "name" : "s",
+ "type" : ""
+ }
+ ],
+ "payable" : false,
"type" : "function"
- }
- ]
+ }]
)";
checkInterface(text, interface);
}
@@ -990,28 +997,33 @@ BOOST_AUTO_TEST_CASE(return_structs_with_contracts)
}
)";
char const* interface = R"(
- [
- {
- "constant" : false,
- "payable": false,
+ [{
+ "constant": false,
"inputs": [],
"name": "f",
- "outputs" : [{
- "name" : "s",
- "type" : [{
- "name" : "x",
- "type" : "address[]"
- }, {
- "name" : "y",
- "type" : "address"
- }]
- }, {
- "name" : "c",
- "type" : "address"
- }],
- "type" : "function"
- }
- ]
+ "outputs": [
+ {
+ "components": [
+ {
+ "name": "x",
+ "type": "address[]"
+ },
+ {
+ "name": "y",
+ "type": "address"
+ }
+ ],
+ "name": "s",
+ "type": ""
+ },
+ {
+ "name": "c",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ }]
)";
checkInterface(text, interface);
}
@@ -1025,36 +1037,49 @@ BOOST_AUTO_TEST_CASE(event_structs)
event E(T t, S s);
}
)";
- char const* interface = R"(
- [{
- "anonymous" : false,
- "inputs" : [{
- "indexed" : false,
- "name" : "t",
- "type" : [{
- "name" : "x",
- "type" : "uint256[2]"
- }]
- }, {
- "indexed" : false,
- "name" : "s",
- "type" : [{
- "name" : "a",
- "type" : "uint256"
- }, {
- "name" : "sub",
- "subtype" : [{
- "name" : "x",
- "type" : "uint256[2]"
- }],
- "type" : "[]"
- }, {
- "name" : "b",
- "type" : "bytes"
- }]
- }],
- "name" : "E",
- "type" : "event"
+ char const *interface = R"(
+ [{
+ "anonymous": false,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "x",
+ "type": "uint256[2]"
+ }
+ ],
+ "indexed": false,
+ "name": "t",
+ "type": ""
+ },
+ {
+ "components": [
+ {
+ "name": "a",
+ "type": "uint256"
+ },
+ {
+ "components": [
+ {
+ "name": "x",
+ "type": "uint256[2]"
+ }
+ ],
+ "name": "sub",
+ "type": "[]"
+ },
+ {
+ "name": "b",
+ "type": "bytes"
+ }
+ ],
+ "indexed": false,
+ "name": "s",
+ "type": ""
+ }
+ ],
+ "name": "E",
+ "type": "event"
}]
)";
checkInterface(text, interface);
@@ -1072,38 +1097,50 @@ BOOST_AUTO_TEST_CASE(structs_in_libraries)
)";
char const* interface = R"(
[{
- "constant" : false,
- "inputs" : [{
- "name" : "s",
- "type" : [{
- "name" : "a",
- "type" : "uint256"
- }, {
- "name" : "sub",
- "subtype" : [{
- "name" : "x",
- "type" : "uint256[2]"
- }],
- "type" : "[]"
- }, {
- "name" : "b",
- "type" : "bytes"
- }]
- }],
- "name" : "g",
- "outputs" : [],
- "payable" : false,
- "type" : "function"
- }, {
- "constant" : false,
- "inputs" : [{
- "name" : "s",
- "type" : "L.S storage"
- }],
- "name" : "f",
- "outputs" : [],
- "payable" : false,
- "type" : "function"
+ "constant": false,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "a",
+ "type": "uint256"
+ },
+ {
+ "components": [
+ {
+ "name": "x",
+ "type": "uint256[2]"
+ }
+ ],
+ "name": "sub",
+ "type": "[]"
+ },
+ {
+ "name": "b",
+ "type": "bytes"
+ }
+ ],
+ "name": "s",
+ "type": ""
+ }
+ ],
+ "name": "g",
+ "outputs": [],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "s",
+ "type": "L.S storage"
+ }
+ ],
+ "name": "f",
+ "outputs": [],
+ "payable": false,
+ "type": "function"
}]
)";
checkInterface(text, interface);