aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/Imports.cpp
diff options
context:
space:
mode:
authorDaniel Kirchner <daniel@ekpyron.org>2018-08-10 02:37:49 +0800
committerDaniel Kirchner <daniel@ekpyron.org>2018-08-11 01:26:48 +0800
commit954d7433bd8c10bce917326f70070077f0cfc165 (patch)
treef73a2699f3fc369fd9ae3783b271e9a11171fe80 /test/libsolidity/Imports.cpp
parent43db88b8363d73ee2f5ffa094ff506414261bd11 (diff)
downloaddexon-solidity-954d7433bd8c10bce917326f70070077f0cfc165.tar.gz
dexon-solidity-954d7433bd8c10bce917326f70070077f0cfc165.tar.zst
dexon-solidity-954d7433bd8c10bce917326f70070077f0cfc165.zip
Disallow remappings with empty prefix.
Diffstat (limited to 'test/libsolidity/Imports.cpp')
-rw-r--r--test/libsolidity/Imports.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/test/libsolidity/Imports.cpp b/test/libsolidity/Imports.cpp
index df31ac40..dc33d577 100644
--- a/test/libsolidity/Imports.cpp
+++ b/test/libsolidity/Imports.cpp
@@ -167,7 +167,7 @@ BOOST_AUTO_TEST_CASE(name_clash_in_import)
BOOST_AUTO_TEST_CASE(remappings)
{
CompilerStack c;
- c.setRemappings(vector<string>{"s=s_1.4.6", "t=Tee"});
+ c.setRemappings(vector<CompilerStack::Remapping>{{"", "s", "s_1.4.6"},{"", "t", "Tee"}});
c.addSource("a", "import \"s/s.sol\"; contract A is S {} pragma solidity >=0.0;");
c.addSource("b", "import \"t/tee.sol\"; contract A is Tee {} pragma solidity >=0.0;");
c.addSource("s_1.4.6/s.sol", "contract S {} pragma solidity >=0.0;");
@@ -179,7 +179,7 @@ BOOST_AUTO_TEST_CASE(remappings)
BOOST_AUTO_TEST_CASE(context_dependent_remappings)
{
CompilerStack c;
- c.setRemappings(vector<string>{"a:s=s_1.4.6", "b:s=s_1.4.7"});
+ c.setRemappings(vector<CompilerStack::Remapping>{{"a", "s", "s_1.4.6"}, {"b", "s", "s_1.4.7"}});
c.addSource("a/a.sol", "import \"s/s.sol\"; contract A is SSix {} pragma solidity >=0.0;");
c.addSource("b/b.sol", "import \"s/s.sol\"; contract B is SSeven {} pragma solidity >=0.0;");
c.addSource("s_1.4.6/s.sol", "contract SSix {} pragma solidity >=0.0;");
@@ -200,7 +200,11 @@ BOOST_AUTO_TEST_CASE(filename_with_period)
BOOST_AUTO_TEST_CASE(context_dependent_remappings_ensure_default_and_module_preserved)
{
CompilerStack c;
- c.setRemappings(vector<string>{"foo=vendor/foo_2.0.0", "vendor/bar:foo=vendor/foo_1.0.0", "bar=vendor/bar"});
+ c.setRemappings(vector<CompilerStack::Remapping>{
+ {"", "foo", "vendor/foo_2.0.0"},
+ {"vendor/bar", "foo", "vendor/foo_1.0.0"},
+ {"", "bar", "vendor/bar"}
+ });
c.addSource("main.sol", "import \"foo/foo.sol\"; import {Bar} from \"bar/bar.sol\"; contract Main is Foo2, Bar {} pragma solidity >=0.0;");
c.addSource("vendor/bar/bar.sol", "import \"foo/foo.sol\"; contract Bar {Foo1 foo;} pragma solidity >=0.0;");
c.addSource("vendor/foo_1.0.0/foo.sol", "contract Foo1 {} pragma solidity >=0.0;");
@@ -212,7 +216,7 @@ BOOST_AUTO_TEST_CASE(context_dependent_remappings_ensure_default_and_module_pres
BOOST_AUTO_TEST_CASE(context_dependent_remappings_order_independent)
{
CompilerStack c;
- c.setRemappings(vector<string>{"a:x/y/z=d", "a/b:x=e"});
+ c.setRemappings(vector<CompilerStack::Remapping>{{"a", "x/y/z", "d"}, {"a/b", "x", "e"}});
c.addSource("a/main.sol", "import \"x/y/z/z.sol\"; contract Main is D {} pragma solidity >=0.0;");
c.addSource("a/b/main.sol", "import \"x/y/z/z.sol\"; contract Main is E {} pragma solidity >=0.0;");
c.addSource("d/z.sol", "contract D {} pragma solidity >=0.0;");
@@ -220,7 +224,7 @@ BOOST_AUTO_TEST_CASE(context_dependent_remappings_order_independent)
c.setEVMVersion(dev::test::Options::get().evmVersion());
BOOST_CHECK(c.compile());
CompilerStack d;
- d.setRemappings(vector<string>{"a/b:x=e", "a:x/y/z=d"});
+ d.setRemappings(vector<CompilerStack::Remapping>{{"a/b", "x", "e"}, {"a", "x/y/z", "d"}});
d.addSource("a/main.sol", "import \"x/y/z/z.sol\"; contract Main is D {} pragma solidity >=0.0;");
d.addSource("a/b/main.sol", "import \"x/y/z/z.sol\"; contract Main is E {} pragma solidity >=0.0;");
d.addSource("d/z.sol", "contract D {} pragma solidity >=0.0;");