diff options
author | chriseth <chris@ethereum.org> | 2018-02-16 17:58:50 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-02-20 20:06:28 +0800 |
commit | decfa0eed0512ec20aa15c3b7656f8369e9fdcba (patch) | |
tree | 5b9d8ece77e2dfc6edbff5b1bdffde1423c37f9e /test/libsolidity/Imports.cpp | |
parent | a6b52fdc34650c74597c1bcdc5075b6375c62650 (diff) | |
download | dexon-solidity-decfa0eed0512ec20aa15c3b7656f8369e9fdcba.tar.gz dexon-solidity-decfa0eed0512ec20aa15c3b7656f8369e9fdcba.tar.zst dexon-solidity-decfa0eed0512ec20aa15c3b7656f8369e9fdcba.zip |
Test aliasing in shadowing.
Diffstat (limited to 'test/libsolidity/Imports.cpp')
-rw-r--r-- | test/libsolidity/Imports.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/test/libsolidity/Imports.cpp b/test/libsolidity/Imports.cpp index 03287b28..dc1174f4 100644 --- a/test/libsolidity/Imports.cpp +++ b/test/libsolidity/Imports.cpp @@ -266,7 +266,28 @@ BOOST_AUTO_TEST_CASE(shadowing_builtins_with_multiple_imports) } } - +BOOST_AUTO_TEST_CASE(shadowing_builtins_with_alias) +{ + CompilerStack c; + c.addSource("B.sol", "contract C {} pragma solidity >=0.0;"); + c.addSource("b", R"( + pragma solidity >=0.0; + import {C as msg} from "B.sol"; + )"); + BOOST_CHECK(c.compile()); + auto numErrors = c.errors().size(); + // Sometimes we get the prerelease warning, sometimes not. + BOOST_CHECK(1 <= numErrors && numErrors <= 2); + for (auto const& e: c.errors()) + { + string const* msg = e->comment(); + BOOST_REQUIRE(msg); + BOOST_CHECK( + msg->find("pre-release") != string::npos || + msg->find("shadows a builtin symbol") != string::npos + ); + } +} BOOST_AUTO_TEST_SUITE_END() |