diff options
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 13 | ||||
-rw-r--r-- | test/libsolidity/SolidityNameAndTypeResolution.cpp | 10 |
2 files changed, 23 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 14bf28a9..a370aafa 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -2541,6 +2541,19 @@ BOOST_AUTO_TEST_CASE(inherited_fallback_function) BOOST_CHECK(callContractFunction("getData()") == encodeArgs(1)); } +BOOST_AUTO_TEST_CASE(default_fallback_throws) +{ + char const* sourceCode = R"( + contract A { + function f() returns (bool) { + return this.call(); + } + } + )"; + compileAndRun(sourceCode); + BOOST_CHECK(callContractFunction("f()") == encodeArgs(0)); +} + BOOST_AUTO_TEST_CASE(event) { char const* sourceCode = R"( diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index f0ab07c5..fdd8d7f4 100644 --- a/test/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp @@ -1102,6 +1102,16 @@ BOOST_AUTO_TEST_CASE(fallback_function_with_arguments) BOOST_CHECK(expectError(text) == Error::Type::TypeError); } +BOOST_AUTO_TEST_CASE(fallback_function_in_library) +{ + char const* text = R"( + library C { + function() {} + } + )"; + BOOST_CHECK(expectError(text) == Error::Type::TypeError); +} + BOOST_AUTO_TEST_CASE(fallback_function_with_return_parameters) { char const* text = R"( |