diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/liblll/EndToEndTest.cpp | 7 | ||||
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 10 | ||||
-rw-r--r-- | test/libsolidity/SolidityNameAndTypeResolution.cpp | 26 |
3 files changed, 43 insertions, 0 deletions
diff --git a/test/liblll/EndToEndTest.cpp b/test/liblll/EndToEndTest.cpp index 77c1f740..c7c1fd3b 100644 --- a/test/liblll/EndToEndTest.cpp +++ b/test/liblll/EndToEndTest.cpp @@ -50,6 +50,13 @@ BOOST_AUTO_TEST_CASE(bare_panic) BOOST_REQUIRE(m_output.empty()); } +BOOST_AUTO_TEST_CASE(panic) +{ + char const* sourceCode = "{ (panic) }"; + compileAndRunWithoutCheck(sourceCode); + BOOST_REQUIRE(m_output.empty()); +} + BOOST_AUTO_TEST_CASE(exp_operator_const) { char const* sourceCode = R"( diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index b2b5a25e..da7adbbf 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -2505,6 +2505,16 @@ BOOST_AUTO_TEST_CASE(constructor_argument_overriding) BOOST_CHECK(callContractFunction("getA()") == encodeArgs(3)); } +BOOST_AUTO_TEST_CASE(internal_constructor) +{ + char const* sourceCode = R"( + contract C { + function C() internal {} + } + )"; + BOOST_CHECK(compileAndRunWithoutCheck(sourceCode, 0, "C").empty()); +} + BOOST_AUTO_TEST_CASE(function_modifier) { char const* sourceCode = R"( diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index 39fbc019..ce241c78 100644 --- a/test/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp @@ -4957,6 +4957,32 @@ BOOST_AUTO_TEST_CASE(assignment_to_constant) CHECK_ERROR(text, TypeError, "Cannot assign to a constant variable."); } +BOOST_AUTO_TEST_CASE(inconstructible_internal_constructor) +{ + char const* text = R"( + contract C { + function C() internal {} + } + contract D { + function f() { var x = new C(); } + } + )"; + CHECK_ERROR(text, TypeError, "Contract with internal constructor cannot be created directly."); +} + +BOOST_AUTO_TEST_CASE(constructible_internal_constructor) +{ + char const* text = R"( + contract C { + function C() internal {} + } + contract D is C { + function D() { } + } + )"; + success(text); +} + BOOST_AUTO_TEST_SUITE_END() } |