aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2016-01-11 20:55:58 +0800
committerchriseth <c@ethdev.com>2016-01-11 20:56:02 +0800
commitf20a604c5a941ed5117d3e472b5ad93bed02fd97 (patch)
tree0e08a74d3432787f135fbd471b5cdf3fa1251321 /test/libsolidity
parentaa645d11927dce715ed3507e4b2ae89cf984a488 (diff)
downloaddexon-solidity-f20a604c5a941ed5117d3e472b5ad93bed02fd97.tar.gz
dexon-solidity-f20a604c5a941ed5117d3e472b5ad93bed02fd97.tar.zst
dexon-solidity-f20a604c5a941ed5117d3e472b5ad93bed02fd97.zip
Allow aliases during import.
Diffstat (limited to 'test/libsolidity')
-rw-r--r--test/libsolidity/Imports.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/libsolidity/Imports.cpp b/test/libsolidity/Imports.cpp
index f0f67785..c074b332 100644
--- a/test/libsolidity/Imports.cpp
+++ b/test/libsolidity/Imports.cpp
@@ -101,6 +101,31 @@ BOOST_AUTO_TEST_CASE(simple_alias)
BOOST_CHECK(c.compile());
}
+BOOST_AUTO_TEST_CASE(complex_import)
+{
+ CompilerStack c;
+ c.addSource("a", "contract A {} contract B {} contract C { struct S { uint a; } }");
+ c.addSource("b", "import \"a\" as x; import {B as b, C as c, C} from \"a\"; "
+ "contract D is b { function f(c.S var1, x.C.S var2, C.S var3) internal {} }");
+ BOOST_CHECK(c.compile());
+}
+
+BOOST_AUTO_TEST_CASE(name_clash_in_import)
+{
+ CompilerStack c;
+ c.addSource("a", "contract A {}");
+ c.addSource("b", "import \"a\"; contract A {} ");
+ BOOST_CHECK(!c.compile());
+ c.addSource("b", "import \"a\" as A; contract A {} ");
+ BOOST_CHECK(!c.compile());
+ c.addSource("b", "import {A as b} from \"a\"; contract b {} ");
+ BOOST_CHECK(!c.compile());
+ c.addSource("b", "import {A} from \"a\"; contract A {} ");
+ BOOST_CHECK(!c.compile());
+ c.addSource("b", "import {A} from \"a\"; contract B {} ");
+ BOOST_CHECK(c.compile());
+}
+
BOOST_AUTO_TEST_SUITE_END()
}