aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/Imports.cpp
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2016-01-14 00:29:34 +0800
committerchriseth <c@ethdev.com>2016-01-14 00:29:34 +0800
commitd2f18c73f75ad5983550fe8a985824d0fda0b640 (patch)
treea0a957e3539f5307c5d3b2091e410415b8e7e85b /test/libsolidity/Imports.cpp
parent02c1aacd25652d39678005294ecbb6180a283134 (diff)
parentf20a604c5a941ed5117d3e472b5ad93bed02fd97 (diff)
downloaddexon-solidity-d2f18c73f75ad5983550fe8a985824d0fda0b640.tar.gz
dexon-solidity-d2f18c73f75ad5983550fe8a985824d0fda0b640.tar.zst
dexon-solidity-d2f18c73f75ad5983550fe8a985824d0fda0b640.zip
Merge pull request #346 from chriseth/importAliases
Allow aliases during import.
Diffstat (limited to 'test/libsolidity/Imports.cpp')
-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()
}