aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/SolidityNameAndTypeResolution.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/libsolidity/SolidityNameAndTypeResolution.cpp')
-rw-r--r--test/libsolidity/SolidityNameAndTypeResolution.cpp73
1 files changed, 73 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp
index 697b3fa9..7e81bd7e 100644
--- a/test/libsolidity/SolidityNameAndTypeResolution.cpp
+++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp
@@ -3750,6 +3750,79 @@ BOOST_AUTO_TEST_CASE(one_divided_by_three_integer_conversion)
BOOST_CHECK(!success(text));
}
+BOOST_AUTO_TEST_CASE(unused_return_value)
+{
+ char const* text = R"(
+ contract test {
+ function g() returns (uint) {}
+ function f() {
+ g();
+ }
+ }
+ )";
+ BOOST_CHECK(success(text));
+}
+
+BOOST_AUTO_TEST_CASE(unused_return_value_send)
+{
+ char const* text = R"(
+ contract test {
+ function f() {
+ address(0x12).send(1);
+ }
+ }
+ )";
+ BOOST_CHECK(expectError(text, true) == Error::Type::Warning);
+}
+
+BOOST_AUTO_TEST_CASE(unused_return_value_call)
+{
+ char const* text = R"(
+ contract test {
+ function f() {
+ address(0x12).call("abc");
+ }
+ }
+ )";
+ BOOST_CHECK(expectError(text, true) == Error::Type::Warning);
+}
+
+BOOST_AUTO_TEST_CASE(unused_return_value_call_value)
+{
+ char const* text = R"(
+ contract test {
+ function f() {
+ address(0x12).call.value(2)("abc");
+ }
+ }
+ )";
+ BOOST_CHECK(expectError(text, true) == Error::Type::Warning);
+}
+
+BOOST_AUTO_TEST_CASE(unused_return_value_callcode)
+{
+ char const* text = R"(
+ contract test {
+ function f() {
+ address(0x12).callcode("abc");
+ }
+ }
+ )";
+ BOOST_CHECK(expectError(text, true) == Error::Type::Warning);
+}
+
+BOOST_AUTO_TEST_CASE(unused_return_value_delegatecall)
+{
+ char const* text = R"(
+ contract test {
+ function f() {
+ address(0x12).delegatecall("abc");
+ }
+ }
+ )";
+ BOOST_CHECK(expectError(text, true) == Error::Type::Warning);
+}
+
BOOST_AUTO_TEST_SUITE_END()
}