aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2018-09-26 05:37:46 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2018-09-26 23:11:02 +0800
commit5d985abcab8d54fcef142f01039ab6d5628f3237 (patch)
tree64af7a53264a0d2273c281db0806c90638e00505
parentc6bd2979b1265cb81d35124a2785e3828658f7cc (diff)
downloaddexon-solidity-5d985abcab8d54fcef142f01039ab6d5628f3237.tar
dexon-solidity-5d985abcab8d54fcef142f01039ab6d5628f3237.tar.gz
dexon-solidity-5d985abcab8d54fcef142f01039ab6d5628f3237.tar.bz2
dexon-solidity-5d985abcab8d54fcef142f01039ab6d5628f3237.tar.lz
dexon-solidity-5d985abcab8d54fcef142f01039ab6d5628f3237.tar.xz
dexon-solidity-5d985abcab8d54fcef142f01039ab6d5628f3237.tar.zst
dexon-solidity-5d985abcab8d54fcef142f01039ab6d5628f3237.zip
Add test for extcodehash
-rw-r--r--test/libsolidity/SolidityNameAndTypeResolution.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp
index b2e2b63b..640bf4d0 100644
--- a/test/libsolidity/SolidityNameAndTypeResolution.cpp
+++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp
@@ -415,6 +415,19 @@ BOOST_AUTO_TEST_CASE(create2_as_variable)
CHECK_ALLOW_MULTI(text, expectations);
}
+BOOST_AUTO_TEST_CASE(extcodehash_as_variable)
+{
+ char const* text = R"(
+ contract c { function f() public view { uint extcodehash; extcodehash; assembly { pop(extcodehash(0)) } }}
+ )";
+ // This needs special treatment, because the message mentions the EVM version,
+ // so cannot be run via isoltest.
+ CHECK_ALLOW_MULTI(text, (std::vector<std::pair<Error::Type, std::string>>{
+ {Error::Type::Warning, "Variable is shadowed in inline assembly by an instruction of the same name"},
+ {Error::Type::Warning, "The \"extcodehash\" instruction is not supported by the VM version"},
+ }));
+}
+
BOOST_AUTO_TEST_CASE(getter_is_memory_type)
{
char const* text = R"(