From 546aca2a3ec11df5b54d5a3d01948ebc3d830163 Mon Sep 17 00:00:00 2001
From: chriseth <c@ethdev.com>
Date: Fri, 26 Aug 2016 16:56:36 +0200
Subject: Test cases.

---
 test/libsolidity/SolidityEndToEndTest.cpp          | 13 +++++++++++++
 test/libsolidity/SolidityNameAndTypeResolution.cpp | 10 ++++++++++
 2 files changed, 23 insertions(+)

(limited to 'test')

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"(
-- 
cgit v1.2.3