aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-02-06 22:59:35 +0800
committerchriseth <chris@ethereum.org>2018-05-02 23:39:42 +0800
commit78945e81e46ab12c864bdb8a2d8a03a80fbfdbdd (patch)
tree55beb88f2237b2615e2f6777c327f86941e8658f /test
parentbf27e869842790cd3e4c84f5c820d80a4071ee5c (diff)
downloaddexon-solidity-78945e81e46ab12c864bdb8a2d8a03a80fbfdbdd.tar.gz
dexon-solidity-78945e81e46ab12c864bdb8a2d8a03a80fbfdbdd.tar.zst
dexon-solidity-78945e81e46ab12c864bdb8a2d8a03a80fbfdbdd.zip
Test the removal of the result variable.
Diffstat (limited to 'test')
-rw-r--r--test/libjulia/Inliner.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/libjulia/Inliner.cpp b/test/libjulia/Inliner.cpp
index 7950941d..05515c57 100644
--- a/test/libjulia/Inliner.cpp
+++ b/test/libjulia/Inliner.cpp
@@ -310,4 +310,34 @@ BOOST_AUTO_TEST_CASE(move_up_rightwards_arguments)
);
}
+BOOST_AUTO_TEST_CASE(pop_result)
+{
+ // This tests that `pop(r)` is removed.
+ BOOST_CHECK_EQUAL(
+ fullInline(R"({
+ function f(a) -> x { let r := mul(a, a) x := add(r, r) }
+ pop(add(f(7), 2))
+ })", false),
+ format(R"({
+ {
+ let _1 := 2
+ let f_a := 7
+ let f_x
+ {
+ let f_r := mul(f_a, f_a)
+ f_x := add(f_r, f_r)
+ }
+ {
+ }
+ }
+ function f(a) -> x
+ {
+ let r := mul(a, a)
+ x := add(r, r)
+ }
+ })", false)
+ );
+}
+
+
BOOST_AUTO_TEST_SUITE_END()