From a1aee031d1fd1b773c2184280625a00a6c84ae7d Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 6 Jun 2016 19:35:55 +0200 Subject: [PATCH] Tests for implementation by constructor. --- .../libsolidity/SolidityNameAndTypeResolution.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index 3b148c9a1..697b3fa98 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; + 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> nodes = sourceUnit->nodes(); + BOOST_CHECK_EQUAL(nodes.size(), 2); + ContractDefinition* derived = dynamic_cast(nodes[1].get()); + BOOST_CHECK(derived); + BOOST_CHECK(!derived->annotation().isFullyImplemented); +} + BOOST_AUTO_TEST_CASE(function_canonical_signature) { ASTPointer sourceUnit;