Fix tests.

This commit is contained in:
chriseth 2017-08-24 15:08:31 +02:00 committed by Alex Beregszaszi
parent 44825d1c1e
commit 6385641f6e
5 changed files with 11 additions and 6 deletions

View File

@ -50,7 +50,7 @@ private:
std::vector<TypePointer> const& _types, std::vector<TypePointer> const& _types,
bool _forLibrary bool _forLibrary
); );
/// @returns a Json object with "name", "type" and potentially "subtype" keys, according /// @returns a Json object with "name", "type" and potentially "components" keys, according
/// to the ABI specification. /// to the ABI specification.
/// If it is possible to express the type as a single string, it is allowed to return a single string. /// If it is possible to express the type as a single string, it is allowed to return a single string.
static Json::Value formatType(std::string const& _name, Type const& _type, bool _forLibrary); static Json::Value formatType(std::string const& _name, Type const& _type, bool _forLibrary);

View File

@ -981,6 +981,7 @@ BOOST_AUTO_TEST_CASE(return_structs)
} }
], ],
"payable" : false, "payable" : false,
"stateMutability" : "nonpayable",
"type" : "function" "type" : "function"
}] }]
)"; )";
@ -1022,6 +1023,7 @@ BOOST_AUTO_TEST_CASE(return_structs_with_contracts)
} }
], ],
"payable": false, "payable": false,
"stateMutability" : "nonpayable",
"type": "function" "type": "function"
}] }]
)"; )";
@ -1127,6 +1129,7 @@ BOOST_AUTO_TEST_CASE(structs_in_libraries)
"name": "g", "name": "g",
"outputs": [], "outputs": [],
"payable": false, "payable": false,
"stateMutability": "nonpayable",
"type": "function" "type": "function"
}, },
{ {
@ -1140,6 +1143,7 @@ BOOST_AUTO_TEST_CASE(structs_in_libraries)
"name": "f", "name": "f",
"outputs": [], "outputs": [],
"payable": false, "payable": false,
"stateMutability": "nonpayable",
"type": "function" "type": "function"
}] }]
)"; )";

View File

@ -9685,6 +9685,7 @@ BOOST_AUTO_TEST_CASE(contracts_separated_with_comment)
BOOST_AUTO_TEST_CASE(return_structs) BOOST_AUTO_TEST_CASE(return_structs)
{ {
char const* sourceCode = R"( char const* sourceCode = R"(
pragma experimental ABIEncoderV2;
contract C { contract C {
struct S { uint a; T[] sub; } struct S { uint a; T[] sub; }
struct T { uint[2] x; } struct T { uint[2] x; }

View File

@ -1102,7 +1102,7 @@ BOOST_AUTO_TEST_CASE(struct_accessor_one_array_only)
Data public data; Data public data;
} }
)"; )";
CHECK_ERROR(sourceCode, TypeError, "Internal type is not allowed for public state variables."); CHECK_ERROR(sourceCode, TypeError, "Internal or recursive type is not allowed for public state variables.");
} }
BOOST_AUTO_TEST_CASE(base_class_state_variable_internal_member) BOOST_AUTO_TEST_CASE(base_class_state_variable_internal_member)
@ -4904,7 +4904,7 @@ BOOST_AUTO_TEST_CASE(internal_function_as_external_parameter)
} }
} }
)"; )";
CHECK_ERROR(text, TypeError, "Internal type is not allowed for public or external functions."); CHECK_ERROR(text, TypeError, "Internal or recursive type is not allowed for public or external functions.");
} }
BOOST_AUTO_TEST_CASE(internal_function_returned_from_public_function) BOOST_AUTO_TEST_CASE(internal_function_returned_from_public_function)
@ -4916,7 +4916,7 @@ BOOST_AUTO_TEST_CASE(internal_function_returned_from_public_function)
} }
} }
)"; )";
CHECK_ERROR(text, TypeError, "Internal type is not allowed for public or external functions."); CHECK_ERROR(text, TypeError, "Internal or recursive type is not allowed for public or external functions.");
} }
BOOST_AUTO_TEST_CASE(internal_function_as_external_parameter_in_library_internal) BOOST_AUTO_TEST_CASE(internal_function_as_external_parameter_in_library_internal)
@ -4938,7 +4938,7 @@ BOOST_AUTO_TEST_CASE(internal_function_as_external_parameter_in_library_external
} }
} }
)"; )";
CHECK_ERROR(text, TypeError, "Internal type is not allowed for public or external functions."); CHECK_ERROR(text, TypeError, "Internal or recursive type is not allowed for public or external functions.");
} }
BOOST_AUTO_TEST_CASE(function_type_arrays) BOOST_AUTO_TEST_CASE(function_type_arrays)