From 78945e81e46ab12c864bdb8a2d8a03a80fbfdbdd Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 6 Feb 2018 15:59:35 +0100 Subject: [PATCH] Test the removal of the result variable. --- test/libjulia/Inliner.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/test/libjulia/Inliner.cpp b/test/libjulia/Inliner.cpp index 7950941d9..05515c57c 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()