Update tests to remove support for loose assembly

This commit is contained in:
Christian Parpart
2018-08-02 13:37:13 +01:00
committed by Alex Beregszaszi
parent ed3cb327ea
commit 9b8a05ebfb
10 changed files with 24 additions and 81 deletions
@@ -390,12 +390,10 @@ BOOST_AUTO_TEST_CASE(unsatisfied_version)
BOOST_AUTO_TEST_CASE(returndatasize_as_variable)
{
char const* text = R"(
contract c { function f() public { uint returndatasize; assembly { returndatasize }}}
contract C { function f() public pure { uint returndatasize; returndatasize; assembly { pop(returndatasize()) }}}
)";
vector<pair<Error::Type, std::string>> expectations(vector<pair<Error::Type, std::string>>{
{Error::Type::Warning, "Variable is shadowed in inline assembly by an instruction of the same name"},
{Error::Type::Warning, "The use of non-functional instructions is deprecated."},
{Error::Type::DeclarationError, "Unbalanced stack"}
{Error::Type::Warning, "Variable is shadowed in inline assembly by an instruction of the same name"}
});
if (!dev::test::Options::get().evmVersion().supportsReturndata())
expectations.emplace_back(make_pair(Error::Type::Warning, std::string("\"returndatasize\" instruction is only available for Byzantium-compatible")));
@@ -405,15 +403,13 @@ BOOST_AUTO_TEST_CASE(returndatasize_as_variable)
BOOST_AUTO_TEST_CASE(create2_as_variable)
{
char const* text = R"(
contract c { function f() public { uint create2; assembly { create2(0, 0, 0, 0) } }}
contract c { function f() public { uint create2; create2; assembly { pop(create2(0, 0, 0, 0)) } }}
)";
// This needs special treatment, because the message mentions the EVM version,
// so cannot be run via isoltest.
CHECK_ALLOW_MULTI(text, (std::vector<std::pair<Error::Type, std::string>>{
{Error::Type::Warning, "Variable is shadowed in inline assembly by an instruction of the same name"},
{Error::Type::Warning, "The \"create2\" instruction is not supported by the VM version"},
{Error::Type::DeclarationError, "Unbalanced stack"},
{Error::Type::Warning, "not supposed to return values"}
}));
}