aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-04-28 17:31:40 +0800
committerchriseth <c@ethdev.com>2015-04-28 17:31:40 +0800
commit0e5331f62c1a5384b9cff20c5499c89c12b82c5b (patch)
tree00b08b9e389db88b7f2195275f300b29be0a2120 /libsolidity
parentceb9326eb289fbd5f234f407aa940b973e4b60d0 (diff)
downloaddexon-solidity-0e5331f62c1a5384b9cff20c5499c89c12b82c5b.tar.gz
dexon-solidity-0e5331f62c1a5384b9cff20c5499c89c12b82c5b.tar.zst
dexon-solidity-0e5331f62c1a5384b9cff20c5499c89c12b82c5b.zip
Fix for deleting byte array elements.
Fixes #1759.
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/SolidityEndToEndTest.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/libsolidity/SolidityEndToEndTest.cpp b/libsolidity/SolidityEndToEndTest.cpp
index 596f710b..24e5f7b4 100644
--- a/libsolidity/SolidityEndToEndTest.cpp
+++ b/libsolidity/SolidityEndToEndTest.cpp
@@ -3381,6 +3381,26 @@ BOOST_AUTO_TEST_CASE(bytes_index_access)
BOOST_CHECK(callContractFunction("storageWrite()") == encodeArgs(0x193));
}
+BOOST_AUTO_TEST_CASE(bytes_delete_element)
+{
+ char const* sourceCode = R"(
+ contract c {
+ bytes data;
+ function test1() external returns (bool) {
+ data.length = 100;
+ for (uint i = 0; i < data.length; i++)
+ data[i] = byte(i);
+ delete data[94];
+ delete data[96];
+ delete data[98];
+ return data[94] == 0 && data[95] == 95 && data[96] == 0 && data[97] == 97;
+ }
+ }
+ )";
+ compileAndRun(sourceCode);
+ BOOST_CHECK(callContractFunction("test1()") == encodeArgs(true));
+}
+
BOOST_AUTO_TEST_CASE(array_copy_calldata_storage)
{
char const* sourceCode = R"(