aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-10-18 04:07:05 +0800
committerchriseth <chris@ethereum.org>2018-10-18 04:07:05 +0800
commit56425bb2b1cb9937b7c7a6baaee5ddcdd1f2e3d1 (patch)
tree2b0232005fb1e395f441c53be081b9860f4b5aa2 /test/libsolidity
parent3d1ca07e9b4b42355aa9be5db5c00048607986d1 (diff)
downloaddexon-solidity-56425bb2b1cb9937b7c7a6baaee5ddcdd1f2e3d1.tar.gz
dexon-solidity-56425bb2b1cb9937b7c7a6baaee5ddcdd1f2e3d1.tar.zst
dexon-solidity-56425bb2b1cb9937b7c7a6baaee5ddcdd1f2e3d1.zip
Add a test for delete x.length
Diffstat (limited to 'test/libsolidity')
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index 7a496e64..7f865aa1 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -1787,6 +1787,24 @@ BOOST_AUTO_TEST_CASE(deleteLocals)
ABI_CHECK(callContractFunction("delLocal()"), encodeArgs(6, 7));
}
+BOOST_AUTO_TEST_CASE(deleteLength)
+{
+ char const* sourceCode = R"(
+ contract test {
+ uint[] x;
+ function f() public returns (uint){
+ x.length = 1;
+ x[0] = 1;
+ delete x.length;
+ return x.length;
+ }
+ }
+ )";
+ compileAndRun(sourceCode);
+ ABI_CHECK(callContractFunction("f()"), encodeArgs(0));
+ BOOST_CHECK(storageEmpty(m_contractAddress));
+}
+
BOOST_AUTO_TEST_CASE(constructor)
{
char const* sourceCode = R"(