diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-02-10 00:34:48 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-02-11 06:44:29 +0800 |
commit | f26fe5bc1c835302af27981e96d0ebbf31c80389 (patch) | |
tree | 2589c9d422e09a3ddeaabf8d37c9581a01ae0901 /test/libsolidity/SolidityEndToEndTest.cpp | |
parent | 28a7b1e019dc6f694d0615d7ef1220f19c10e861 (diff) | |
download | dexon-solidity-f26fe5bc1c835302af27981e96d0ebbf31c80389.tar.gz dexon-solidity-f26fe5bc1c835302af27981e96d0ebbf31c80389.tar.zst dexon-solidity-f26fe5bc1c835302af27981e96d0ebbf31c80389.zip |
Add tests for revert()
Diffstat (limited to 'test/libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index e49db34e..8c0e29fd 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -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() } |