aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-11-23 03:39:10 +0800
committerchriseth <c@ethdev.com>2015-11-27 00:49:39 +0800
commitd71cd3aa2b235f877b7928b57c94159e2c16865c (patch)
treeb24bc90e27cdc7e8cf2a5674aa9376bef72db2aa /test/libsolidity
parent09b2f9acb7f5f47f53c4b56fdf0f86946551bf12 (diff)
downloaddexon-solidity-d71cd3aa2b235f877b7928b57c94159e2c16865c.tar
dexon-solidity-d71cd3aa2b235f877b7928b57c94159e2c16865c.tar.gz
dexon-solidity-d71cd3aa2b235f877b7928b57c94159e2c16865c.tar.bz2
dexon-solidity-d71cd3aa2b235f877b7928b57c94159e2c16865c.tar.lz
dexon-solidity-d71cd3aa2b235f877b7928b57c94159e2c16865c.tar.xz
dexon-solidity-d71cd3aa2b235f877b7928b57c94159e2c16865c.tar.zst
dexon-solidity-d71cd3aa2b235f877b7928b57c94159e2c16865c.zip
Added the `using x for y` directive.
Diffstat (limited to 'test/libsolidity')
-rw-r--r--test/libsolidity/SolidityNameAndTypeResolution.cpp22
-rw-r--r--test/libsolidity/SolidityParser.cpp15
2 files changed, 37 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp
index 4f26fa4d..f96f7046 100644
--- a/test/libsolidity/SolidityNameAndTypeResolution.cpp
+++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp
@@ -2529,6 +2529,28 @@ BOOST_AUTO_TEST_CASE(member_access_parser_ambiguity)
BOOST_CHECK(success(text));
}
+BOOST_AUTO_TEST_CASE(using_for_library)
+{
+ char const* text = R"(
+ library D { }
+ contract C {
+ using D for uint;
+ }
+ )";
+ BOOST_CHECK(success(text));
+}
+
+BOOST_AUTO_TEST_CASE(using_for_not_library)
+{
+ char const* text = R"(
+ contract D { }
+ contract C {
+ using D for uint;
+ }
+ )";
+ BOOST_CHECK(expectError(text) == Error::Type::TypeError);
+}
+
BOOST_AUTO_TEST_CASE(create_memory_arrays)
{
char const* text = R"(
diff --git a/test/libsolidity/SolidityParser.cpp b/test/libsolidity/SolidityParser.cpp
index 7451397e..fd9076c3 100644
--- a/test/libsolidity/SolidityParser.cpp
+++ b/test/libsolidity/SolidityParser.cpp
@@ -1032,6 +1032,21 @@ BOOST_AUTO_TEST_CASE(member_access_parser_ambiguity)
BOOST_CHECK(successParse(text));
}
+BOOST_AUTO_TEST_CASE(using_for)
+{
+ char const* text = R"(
+ contract C {
+ struct s { uint a; }
+ using LibraryName for uint;
+ using Library2 for *;
+ using Lib for s;
+ function f() {
+ }
+ }
+ )";
+ BOOST_CHECK(successParse(text));
+}
+
BOOST_AUTO_TEST_SUITE_END()
}