diff options
author | chriseth <c@ethdev.com> | 2015-12-18 20:02:01 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-12-18 20:02:01 +0800 |
commit | 938ed70935a434babb8c52e6a2985b98216b37c6 (patch) | |
tree | 2c9246af514f8023117800bd8675703fc8d02fb4 /test | |
parent | fe23cc82263c75f34e05795e12fedb08bc14e6a4 (diff) | |
parent | 603dc58040e62ef99d0a10084340dd4548a438a8 (diff) | |
download | dexon-solidity-938ed70935a434babb8c52e6a2985b98216b37c6.tar.gz dexon-solidity-938ed70935a434babb8c52e6a2985b98216b37c6.tar.zst dexon-solidity-938ed70935a434babb8c52e6a2985b98216b37c6.zip |
Merge pull request #304 from chriseth/imp
Simple aliasing during import
Diffstat (limited to 'test')
-rw-r--r-- | test/libsolidity/Imports.cpp | 8 | ||||
-rw-r--r-- | test/libsolidity/SolidityParser.cpp | 21 |
2 files changed, 29 insertions, 0 deletions
diff --git a/test/libsolidity/Imports.cpp b/test/libsolidity/Imports.cpp index ab8e2257..57239cb9 100644 --- a/test/libsolidity/Imports.cpp +++ b/test/libsolidity/Imports.cpp @@ -93,6 +93,14 @@ BOOST_AUTO_TEST_CASE(relative_import_multiplex) BOOST_CHECK(c.compile()); } +BOOST_AUTO_TEST_CASE(simple_alias) +{ + CompilerStack c; + c.addSource("a", "contract A {}"); + c.addSource("dir/a/b/c", "import \"../../.././a\" as x; contract B { function() { x.A r = x.A(20); } }"); + BOOST_CHECK(c.compile()); +} + BOOST_AUTO_TEST_SUITE_END() } diff --git a/test/libsolidity/SolidityParser.cpp b/test/libsolidity/SolidityParser.cpp index e6c8a8d8..5c5a9f68 100644 --- a/test/libsolidity/SolidityParser.cpp +++ b/test/libsolidity/SolidityParser.cpp @@ -1047,6 +1047,27 @@ BOOST_AUTO_TEST_CASE(using_for) BOOST_CHECK(successParse(text)); } +BOOST_AUTO_TEST_CASE(complex_import) +{ + char const* text = R"( + import "abc" as x; + import * as x from "abc"; + import {a as b, c as d, f} from "def"; + contract x {} + )"; + BOOST_CHECK(successParse(text)); +} + +BOOST_AUTO_TEST_CASE(from_is_not_keyword) +{ + // "from" is not a keyword although it is used as a keyword in import directives. + char const* text = R"( + contract from { + } + )"; + BOOST_CHECK(successParse(text)); +} + BOOST_AUTO_TEST_CASE(inline_array_declaration) { char const* text = R"( |