aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-06-22 22:42:35 +0800
committerchriseth <chris@ethereum.org>2017-06-22 22:48:44 +0800
commit9eaf26a35900eb6c26e098e3caa822038c0dc0fa (patch)
tree24fad44844f230e6aedc404162d28e000ec4ae2f /test
parentf90a514f80b74518fbbdd7ef3a511df4f13abed2 (diff)
downloaddexon-solidity-9eaf26a35900eb6c26e098e3caa822038c0dc0fa.tar
dexon-solidity-9eaf26a35900eb6c26e098e3caa822038c0dc0fa.tar.gz
dexon-solidity-9eaf26a35900eb6c26e098e3caa822038c0dc0fa.tar.bz2
dexon-solidity-9eaf26a35900eb6c26e098e3caa822038c0dc0fa.tar.lz
dexon-solidity-9eaf26a35900eb6c26e098e3caa822038c0dc0fa.tar.xz
dexon-solidity-9eaf26a35900eb6c26e098e3caa822038c0dc0fa.tar.zst
dexon-solidity-9eaf26a35900eb6c26e098e3caa822038c0dc0fa.zip
Check for address-like strings being treated as addresses.
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/SolidityNameAndTypeResolution.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp
index 0b3cb481..1c563cf6 100644
--- a/test/libsolidity/SolidityNameAndTypeResolution.cpp
+++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp
@@ -5415,6 +5415,25 @@ BOOST_AUTO_TEST_CASE(invalid_address_length)
CHECK_WARNING(text, "checksum");
}
+BOOST_AUTO_TEST_CASE(address_test_for_bug_in_implementation)
+{
+ // A previous implementation claimed the string would be an address
+ char const* text = R"(
+ contract AddrString {
+ address public test = "0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c";
+ }
+ )";
+ CHECK_ERROR(text, TypeError, "is not implicitly convertible to expected type address");
+ text = R"(
+ contract AddrString {
+ function f() returns (address) {
+ return "0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c";
+ }
+ }
+ )";
+ CHECK_ERROR(text, TypeError, "is not implicitly convertible to expected type");
+}
+
BOOST_AUTO_TEST_CASE(early_exit_on_fatal_errors)
{
// This tests a crash that occured because we did not stop for fatal errors.