aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2016-05-10 16:46:25 +0800
committerchriseth <c@ethdev.com>2016-05-11 01:33:30 +0800
commitaf354d75552b79144e771799b904e1c87931de90 (patch)
tree9ea31f8aec5e7dc23f53c78e3aa5aca804fe89f1 /test
parenta6fc3c8f30d987f90d791c6cc5ec9d0a6a132109 (diff)
downloaddexon-solidity-af354d75552b79144e771799b904e1c87931de90.tar.gz
dexon-solidity-af354d75552b79144e771799b904e1c87931de90.tar.zst
dexon-solidity-af354d75552b79144e771799b904e1c87931de90.zip
Correctly handle unexpected exceptions during tests.
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/SolidityNameAndTypeResolution.cpp36
1 files changed, 34 insertions, 2 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp
index 48b58b71..d7f7961a 100644
--- a/test/libsolidity/SolidityNameAndTypeResolution.cpp
+++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp
@@ -97,13 +97,20 @@ parseAnalyseAndReturnError(string const& _source, bool _reportWarnings = false)
return make_pair(sourceUnit, std::make_shared<Error::Type const>(currentError->type()));
}
}
+ catch (InternalCompilerError const& _e)
+ {
+ string message("Internal compiler error");
+ if (string const* description = boost::get_error_info<errinfo_comment>(_e))
+ message += ": " + *description;
+ BOOST_FAIL(message);
+ }
catch (Error const& _e)
{
return make_pair(sourceUnit, std::make_shared<Error::Type const>(_e.type()));
}
- catch (Exception const& /*_exception*/)
+ catch (...)
{
- return make_pair(sourceUnit, nullptr);
+ BOOST_FAIL("Unexpected exception.");
}
return make_pair(sourceUnit, nullptr);
}
@@ -3516,6 +3523,19 @@ BOOST_AUTO_TEST_CASE(inline_array_rationals)
BOOST_CHECK(success(text));
}
+BOOST_AUTO_TEST_CASE(rational_index_access)
+{
+ char const* text = R"(
+ contract test {
+ function f() {
+ uint[] memory a;
+ a[.5];
+ }
+ }
+ )";
+ BOOST_CHECK(!success(text));
+}
+
BOOST_AUTO_TEST_CASE(rational_to_fixed_literal_expression)
{
char const* text = R"(
@@ -3578,6 +3598,18 @@ BOOST_AUTO_TEST_CASE(var_capable_of_holding_constant_rationals)
BOOST_CHECK(success(text));
}
+BOOST_AUTO_TEST_CASE(var_and_rational_with_tuple)
+{
+ char const* text = R"(
+ contract test {
+ function f() {
+ var (a, b) = (.5, 1/3);
+ }
+ }
+ )";
+ BOOST_CHECK(success(text));
+}
+
BOOST_AUTO_TEST_CASE(var_handle_divided_integers)
{
char const* text = R"(