mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Check for state changes in revert() tests
This commit is contained in:
parent
f26fe5bc1c
commit
30cfad3548
@ -9100,10 +9100,13 @@ BOOST_AUTO_TEST_CASE(revert)
|
|||||||
{
|
{
|
||||||
char const* sourceCode = R"(
|
char const* sourceCode = R"(
|
||||||
contract C {
|
contract C {
|
||||||
|
uint public a = 42;
|
||||||
function f() {
|
function f() {
|
||||||
|
a = 1;
|
||||||
revert();
|
revert();
|
||||||
}
|
}
|
||||||
function g() {
|
function g() {
|
||||||
|
a = 1;
|
||||||
assembly {
|
assembly {
|
||||||
revert(0, 0)
|
revert(0, 0)
|
||||||
}
|
}
|
||||||
@ -9112,7 +9115,9 @@ BOOST_AUTO_TEST_CASE(revert)
|
|||||||
)";
|
)";
|
||||||
compileAndRun(sourceCode, 0, "C");
|
compileAndRun(sourceCode, 0, "C");
|
||||||
BOOST_CHECK(callContractFunction("f()") == encodeArgs());
|
BOOST_CHECK(callContractFunction("f()") == encodeArgs());
|
||||||
|
BOOST_CHECK(callContractFunction("a()") == encodeArgs(u256(42)));
|
||||||
BOOST_CHECK(callContractFunction("g()") == encodeArgs());
|
BOOST_CHECK(callContractFunction("g()") == encodeArgs());
|
||||||
|
BOOST_CHECK(callContractFunction("a()") == encodeArgs(u256(42)));
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
Loading…
Reference in New Issue
Block a user