mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add a test for delete x.length
This commit is contained in:
parent
3d1ca07e9b
commit
56425bb2b1
@ -1787,6 +1787,24 @@ BOOST_AUTO_TEST_CASE(deleteLocals)
|
|||||||
ABI_CHECK(callContractFunction("delLocal()"), encodeArgs(6, 7));
|
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)
|
BOOST_AUTO_TEST_CASE(constructor)
|
||||||
{
|
{
|
||||||
char const* sourceCode = R"(
|
char const* sourceCode = R"(
|
||||||
|
Loading…
Reference in New Issue
Block a user