Add tests for invalid instruction

This commit is contained in:
Alex Beregszaszi 2017-01-27 21:24:58 +00:00
parent bfa3b4ca78
commit eb530aa217
2 changed files with 20 additions and 0 deletions

View File

@ -182,6 +182,11 @@ BOOST_AUTO_TEST_CASE(error_tag)
BOOST_CHECK(successAssemble("{ invalidJumpLabel }"));
}
BOOST_AUTO_TEST_CASE(designated_invalid_instruction)
{
BOOST_CHECK(successAssemble("{ invalid }"));
}
BOOST_AUTO_TEST_CASE(inline_assembly_shadowed_instruction_declaration)
{
// Error message: "Cannot use instruction names for identifier names."

View File

@ -9043,6 +9043,21 @@ BOOST_AUTO_TEST_CASE(recursive_structs)
BOOST_CHECK(callContractFunction("f()") == encodeArgs(u256(1)));
}
BOOST_AUTO_TEST_CASE(invalid_instruction)
{
char const* sourceCode = R"(
contract C {
function f() {
assembly {
invalid
}
}
}
)";
compileAndRun(sourceCode, 0, "C");
BOOST_CHECK(callContractFunction("f()") == encodeArgs());
}
BOOST_AUTO_TEST_SUITE_END()
}