mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Some more tests.
This commit is contained in:
parent
1a3066c3a1
commit
336c9e8f32
@ -5813,6 +5813,38 @@ BOOST_AUTO_TEST_CASE(warn_multiple_storage_storage_copies_fill_left)
|
|||||||
CHECK_WARNING(text, "This assignment performs two copies to storage.");
|
CHECK_WARNING(text, "This assignment performs two copies to storage.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(nowarn_swap_memory)
|
||||||
|
{
|
||||||
|
char const* text = R"(
|
||||||
|
contract C {
|
||||||
|
struct S { uint a; uint b; }
|
||||||
|
function f() {
|
||||||
|
S memory x;
|
||||||
|
S memory y;
|
||||||
|
(x, y) = (y, x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
CHECK_SUCCESS_NO_WARNINGS(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(nowarn_swap_storage_pointers)
|
||||||
|
{
|
||||||
|
char const* text = R"(
|
||||||
|
contract C {
|
||||||
|
struct S { uint a; uint b; }
|
||||||
|
S x; S y;
|
||||||
|
function f() {
|
||||||
|
S storage x_local = x;
|
||||||
|
S storage y_local = y;
|
||||||
|
S storage z_local = x;
|
||||||
|
(x, y_local, x_local, z_local) = (y, x_local, y_local, y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
CHECK_SUCCESS_NO_WARNINGS(text);
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(warn_unused_local)
|
BOOST_AUTO_TEST_CASE(warn_unused_local)
|
||||||
{
|
{
|
||||||
char const* text = R"(
|
char const* text = R"(
|
||||||
|
Loading…
Reference in New Issue
Block a user