Include ABI JSON test for payable keyword

This commit is contained in:
Alex Beregszaszi 2016-08-02 20:22:26 +01:00 committed by chriseth
parent a34f2f1a31
commit a7794b1a68

View File

@ -68,6 +68,7 @@ BOOST_AUTO_TEST_CASE(basic_test)
{ {
"name": "f", "name": "f",
"constant": false, "constant": false,
"payable" : false,
"type": "function", "type": "function",
"inputs": [ "inputs": [
{ {
@ -107,6 +108,7 @@ BOOST_AUTO_TEST_CASE(multiple_methods)
{ {
"name": "f", "name": "f",
"constant": false, "constant": false,
"payable" : false,
"type": "function", "type": "function",
"inputs": [ "inputs": [
{ {
@ -124,6 +126,7 @@ BOOST_AUTO_TEST_CASE(multiple_methods)
{ {
"name": "g", "name": "g",
"constant": false, "constant": false,
"payable" : false,
"type": "function", "type": "function",
"inputs": [ "inputs": [
{ {
@ -153,6 +156,7 @@ BOOST_AUTO_TEST_CASE(multiple_params)
{ {
"name": "f", "name": "f",
"constant": false, "constant": false,
"payable" : false,
"type": "function", "type": "function",
"inputs": [ "inputs": [
{ {
@ -188,6 +192,7 @@ BOOST_AUTO_TEST_CASE(multiple_methods_order)
{ {
"name": "c", "name": "c",
"constant": false, "constant": false,
"payable" : false,
"type": "function", "type": "function",
"inputs": [ "inputs": [
{ {
@ -205,6 +210,7 @@ BOOST_AUTO_TEST_CASE(multiple_methods_order)
{ {
"name": "f", "name": "f",
"constant": false, "constant": false,
"payable" : false,
"type": "function", "type": "function",
"inputs": [ "inputs": [
{ {
@ -235,6 +241,7 @@ BOOST_AUTO_TEST_CASE(const_function)
{ {
"name": "foo", "name": "foo",
"constant": false, "constant": false,
"payable" : false,
"type": "function", "type": "function",
"inputs": [ "inputs": [
{ {
@ -256,6 +263,7 @@ BOOST_AUTO_TEST_CASE(const_function)
{ {
"name": "boo", "name": "boo",
"constant": true, "constant": true,
"payable" : false,
"type": "function", "type": "function",
"inputs": [{ "inputs": [{
"name": "a", "name": "a",
@ -284,6 +292,7 @@ BOOST_AUTO_TEST_CASE(events)
{ {
"name": "f", "name": "f",
"constant": false, "constant": false,
"payable" : false,
"type": "function", "type": "function",
"inputs": [ "inputs": [
{ {
@ -361,6 +370,7 @@ BOOST_AUTO_TEST_CASE(inherited)
{ {
"name": "baseFunction", "name": "baseFunction",
"constant": false, "constant": false,
"payable" : false,
"type": "function", "type": "function",
"inputs": "inputs":
[{ [{
@ -376,6 +386,7 @@ BOOST_AUTO_TEST_CASE(inherited)
{ {
"name": "derivedFunction", "name": "derivedFunction",
"constant": false, "constant": false,
"payable" : false,
"type": "function", "type": "function",
"inputs": "inputs":
[{ [{
@ -429,6 +440,7 @@ BOOST_AUTO_TEST_CASE(empty_name_input_parameter_with_named_one)
{ {
"name": "f", "name": "f",
"constant": false, "constant": false,
"payable" : false,
"type": "function", "type": "function",
"inputs": [ "inputs": [
{ {
@ -469,6 +481,7 @@ BOOST_AUTO_TEST_CASE(empty_name_return_parameter)
{ {
"name": "f", "name": "f",
"constant": false, "constant": false,
"payable" : false,
"type": "function", "type": "function",
"inputs": [ "inputs": [
{ {
@ -536,6 +549,7 @@ BOOST_AUTO_TEST_CASE(return_param_in_abi)
[ [
{ {
"constant" : false, "constant" : false,
"payable" : false,
"inputs" : [], "inputs" : [],
"name" : "ret", "name" : "ret",
"outputs" : [ "outputs" : [
@ -573,6 +587,7 @@ BOOST_AUTO_TEST_CASE(strings_and_arrays)
[ [
{ {
"constant" : false, "constant" : false,
"payable" : false,
"name": "f", "name": "f",
"inputs": [ "inputs": [
{ "name": "a", "type": "string" }, { "name": "a", "type": "string" },
@ -600,6 +615,7 @@ BOOST_AUTO_TEST_CASE(library_function)
[ [
{ {
"constant" : false, "constant" : false,
"payable" : false,
"name": "f", "name": "f",
"inputs": [ "inputs": [
{ "name": "b", "type": "test.StructType storage" }, { "name": "b", "type": "test.StructType storage" },
@ -636,6 +652,39 @@ BOOST_AUTO_TEST_CASE(include_fallback_function)
checkInterface(sourceCode, interface); checkInterface(sourceCode, interface);
} }
BOOST_AUTO_TEST_CASE(payable_function)
{
char const* sourceCode = R"(
contract test {
function f() {}
function g() payable {}
}
)";
char const* interface = R"(
[
{
"constant" : false,
"payable": false,
"inputs": [],
"name": "f",
"outputs": [],
"type" : "function"
},
{
"constant" : false,
"payable": true,
"inputs": [],
"name": "g",
"outputs": [],
"type" : "function"
}
]
)";
checkInterface(sourceCode, interface);
}
BOOST_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE_END()
} }