aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-08-01 03:54:54 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-08-01 07:03:25 +0800
commit990b7364f598fe8cd2a10ca6eb3d4ea53cb19df3 (patch)
treeb64fc005da20caf277020bc5c4a0f21a98db53bc /test
parent93f90eb292de6396462dd244213457b948852168 (diff)
downloaddexon-solidity-990b7364f598fe8cd2a10ca6eb3d4ea53cb19df3.tar
dexon-solidity-990b7364f598fe8cd2a10ca6eb3d4ea53cb19df3.tar.gz
dexon-solidity-990b7364f598fe8cd2a10ca6eb3d4ea53cb19df3.tar.bz2
dexon-solidity-990b7364f598fe8cd2a10ca6eb3d4ea53cb19df3.tar.lz
dexon-solidity-990b7364f598fe8cd2a10ca6eb3d4ea53cb19df3.tar.xz
dexon-solidity-990b7364f598fe8cd2a10ca6eb3d4ea53cb19df3.tar.zst
dexon-solidity-990b7364f598fe8cd2a10ca6eb3d4ea53cb19df3.zip
Add test for disallowed gas/value modifiers on builtins
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/SolidityNameAndTypeResolution.cpp50
1 files changed, 49 insertions, 1 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp
index cd922cc8..e2e9f08a 100644
--- a/test/libsolidity/SolidityNameAndTypeResolution.cpp
+++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp
@@ -6437,7 +6437,7 @@ BOOST_AUTO_TEST_CASE(using_this_in_constructor)
CHECK_WARNING(text, "\"this\" used in constructor");
}
-BOOST_AUTO_TEST_CASE(do_not_crash_on_not_lalue)
+BOOST_AUTO_TEST_CASE(do_not_crash_on_not_lvalue)
{
// This checks for a bug that caused a crash because of continued analysis.
char const* text = R"(
@@ -6451,6 +6451,54 @@ BOOST_AUTO_TEST_CASE(do_not_crash_on_not_lalue)
CHECK_ERROR_ALLOW_MULTI(text, TypeError, "is not callable");
}
+BOOST_AUTO_TEST_CASE(builtin_reject_gas)
+{
+ char const* text = R"(
+ contract C {
+ function f() {
+ keccak256.gas();
+ }
+ }
+ )";
+ CHECK_ERROR(text, TypeError, "Member \"gas\" not found or not visible after argument-dependent lookup");
+}
+
+BOOST_AUTO_TEST_CASE(builtin_reject_value)
+{
+ char const* text = R"(
+ contract C {
+ function f() {
+ keccak256.value();
+ }
+ }
+ )";
+ CHECK_ERROR(text, TypeError, "Member \"value\" not found or not visible after argument-dependent lookup");
+ text = R"(
+ contract C {
+ function f() {
+ sha256.value();
+ }
+ }
+ )";
+ CHECK_ERROR(text, TypeError, "Member \"value\" not found or not visible after argument-dependent lookup");
+ text = R"(
+ contract C {
+ function f() {
+ ripemd160.value();
+ }
+ }
+ )";
+ CHECK_ERROR(text, TypeError, "Member \"value\" not found or not visible after argument-dependent lookup");
+ text = R"(
+ contract C {
+ function f() {
+ ecrecover.value();
+ }
+ }
+ )";
+ CHECK_ERROR(text, TypeError, "Member \"value\" not found or not visible after argument-dependent lookup");
+}
+
BOOST_AUTO_TEST_SUITE_END()
}