aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-05-31 21:01:45 +0800
committerchriseth <chris@ethereum.org>2018-05-31 21:01:45 +0800
commit4b7e58f22fbac413b8f182cfdd5df9fdf1efd674 (patch)
tree88f1f4d6f59d425facacb3e828216653d05b6054 /test
parent7cf36331a6210a5fa0d7ef7d289b1f358b9e0cb6 (diff)
downloaddexon-solidity-4b7e58f22fbac413b8f182cfdd5df9fdf1efd674.tar
dexon-solidity-4b7e58f22fbac413b8f182cfdd5df9fdf1efd674.tar.gz
dexon-solidity-4b7e58f22fbac413b8f182cfdd5df9fdf1efd674.tar.bz2
dexon-solidity-4b7e58f22fbac413b8f182cfdd5df9fdf1efd674.tar.lz
dexon-solidity-4b7e58f22fbac413b8f182cfdd5df9fdf1efd674.tar.xz
dexon-solidity-4b7e58f22fbac413b8f182cfdd5df9fdf1efd674.tar.zst
dexon-solidity-4b7e58f22fbac413b8f182cfdd5df9fdf1efd674.zip
Add test for pop on the stack.
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index f1fac396..649a1db6 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -5397,6 +5397,40 @@ BOOST_AUTO_TEST_CASE(byte_array_pop_copy_long)
));
}
+BOOST_AUTO_TEST_CASE(array_pop_isolated)
+{
+ char const* sourceCode = R"(
+ // This tests that the compiler knows the correct size of the function on the stack.
+ contract c {
+ uint[] data;
+ function test() public returns (uint x) {
+ x = 2;
+ data.pop;
+ x = 3;
+ }
+ }
+ )";
+ compileAndRun(sourceCode);
+ ABI_CHECK(callContractFunction("test()"), encodeArgs(3));
+}
+
+BOOST_AUTO_TEST_CASE(byte_array_pop_isolated)
+{
+ char const* sourceCode = R"(
+ // This tests that the compiler knows the correct size of the function on the stack.
+ contract c {
+ bytes data;
+ function test() public returns (uint x) {
+ x = 2;
+ data.pop;
+ x = 3;
+ }
+ }
+ )";
+ compileAndRun(sourceCode);
+ ABI_CHECK(callContractFunction("test()"), encodeArgs(3));
+}
+
BOOST_AUTO_TEST_CASE(external_array_args)
{
char const* sourceCode = R"(