aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2016-06-07 01:35:55 +0800
committerchriseth <c@ethdev.com>2016-06-07 01:38:22 +0800
commita1aee031d1fd1b773c2184280625a00a6c84ae7d (patch)
tree0c8c5c43f3de8d5a992c1b1fd347e2b18dbbaf74 /test
parent0a0fc04641787ce057a9fcc9e366ea898b1fd8d6 (diff)
downloaddexon-solidity-a1aee031d1fd1b773c2184280625a00a6c84ae7d.tar.gz
dexon-solidity-a1aee031d1fd1b773c2184280625a00a6c84ae7d.tar.zst
dexon-solidity-a1aee031d1fd1b773c2184280625a00a6c84ae7d.zip
Tests for implementation by constructor.
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/SolidityNameAndTypeResolution.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp
index 3b148c9a..697b3fa9 100644
--- a/test/libsolidity/SolidityNameAndTypeResolution.cpp
+++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp
@@ -544,6 +544,21 @@ BOOST_AUTO_TEST_CASE(redeclare_implemented_abstract_function_as_abstract)
BOOST_CHECK(expectError(text) == Error::Type::TypeError);
}
+BOOST_AUTO_TEST_CASE(implement_abstract_via_constructor)
+{
+ ASTPointer<SourceUnit> sourceUnit;
+ char const* text = R"(
+ contract base { function foo(); }
+ contract foo is base { function foo() {} }
+ )";
+ ETH_TEST_REQUIRE_NO_THROW(sourceUnit = parseAndAnalyse(text), "Parsing and name resolving failed");
+ std::vector<ASTPointer<ASTNode>> nodes = sourceUnit->nodes();
+ BOOST_CHECK_EQUAL(nodes.size(), 2);
+ ContractDefinition* derived = dynamic_cast<ContractDefinition*>(nodes[1].get());
+ BOOST_CHECK(derived);
+ BOOST_CHECK(!derived->annotation().isFullyImplemented);
+}
+
BOOST_AUTO_TEST_CASE(function_canonical_signature)
{
ASTPointer<SourceUnit> sourceUnit;