aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-02-13 21:56:22 +0800
committerGitHub <noreply@github.com>2017-02-13 21:56:22 +0800
commit0d8a9c328910bc9a0ab18beb273c029dc9a05b15 (patch)
tree388b2cc84825e30c0753e480be1d6bb0bbc4db03 /test/libsolidity
parente2349f9d5db80e57558ddaf7564ea57cf3b216d8 (diff)
parentc8ec79548b8f8825735ee96f1768e7fc5313d19e (diff)
downloaddexon-solidity-0d8a9c328910bc9a0ab18beb273c029dc9a05b15.tar.gz
dexon-solidity-0d8a9c328910bc9a0ab18beb273c029dc9a05b15.tar.zst
dexon-solidity-0d8a9c328910bc9a0ab18beb273c029dc9a05b15.zip
Merge pull request #1661 from ethereum/asm-revert
Implement REVERT (EIP140)
Diffstat (limited to 'test/libsolidity')
-rw-r--r--test/libsolidity/InlineAssembly.cpp5
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp24
2 files changed, 29 insertions, 0 deletions
diff --git a/test/libsolidity/InlineAssembly.cpp b/test/libsolidity/InlineAssembly.cpp
index cf0343a9..37d17495 100644
--- a/test/libsolidity/InlineAssembly.cpp
+++ b/test/libsolidity/InlineAssembly.cpp
@@ -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()
}
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index ad045881..68f8fbef 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -9102,6 +9102,30 @@ BOOST_AUTO_TEST_CASE(assert)
BOOST_CHECK(callContractFunction("g(bool)", true) == encodeArgs(true));
}
+BOOST_AUTO_TEST_CASE(revert)
+{
+ char const* sourceCode = R"(
+ contract C {
+ uint public a = 42;
+ function f() {
+ a = 1;
+ revert();
+ }
+ function g() {
+ a = 1;
+ assembly {
+ revert(0, 0)
+ }
+ }
+ }
+ )";
+ compileAndRun(sourceCode, 0, "C");
+ BOOST_CHECK(callContractFunction("f()") == encodeArgs());
+ BOOST_CHECK(callContractFunction("a()") == encodeArgs(u256(42)));
+ BOOST_CHECK(callContractFunction("g()") == encodeArgs());
+ BOOST_CHECK(callContractFunction("a()") == encodeArgs(u256(42)));
+}
+
BOOST_AUTO_TEST_SUITE_END()
}