mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add tests for revert()
This commit is contained in:
parent
28a7b1e019
commit
f26fe5bc1c
@ -205,6 +205,11 @@ BOOST_AUTO_TEST_CASE(inline_assembly_shadowed_instruction_functional_assignment)
|
||||
BOOST_CHECK(!successAssemble("{ gas := 2 }"));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(revert)
|
||||
{
|
||||
BOOST_CHECK(successAssemble("{ revert(0, 0) }"));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
}
|
||||
|
@ -9096,6 +9096,25 @@ BOOST_AUTO_TEST_CASE(assert)
|
||||
BOOST_CHECK(callContractFunction("g(bool)", true) == encodeArgs(true));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(revert)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract C {
|
||||
function f() {
|
||||
revert();
|
||||
}
|
||||
function g() {
|
||||
assembly {
|
||||
revert(0, 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
)";
|
||||
compileAndRun(sourceCode, 0, "C");
|
||||
BOOST_CHECK(callContractFunction("f()") == encodeArgs());
|
||||
BOOST_CHECK(callContractFunction("g()") == encodeArgs());
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user