aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity
diff options
context:
space:
mode:
Diffstat (limited to 'test/libsolidity')
-rw-r--r--test/libsolidity/InlineAssembly.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/test/libsolidity/InlineAssembly.cpp b/test/libsolidity/InlineAssembly.cpp
index 6c04367f..a80a44a2 100644
--- a/test/libsolidity/InlineAssembly.cpp
+++ b/test/libsolidity/InlineAssembly.cpp
@@ -41,7 +41,7 @@ namespace test
namespace
{
-bool successParse(std::string const& _source, bool _assemble = false)
+bool successParse(std::string const& _source, bool _assemble = false, bool _allowWarnings = true)
{
assembly::InlineAssemblyStack stack;
try
@@ -51,8 +51,9 @@ bool successParse(std::string const& _source, bool _assemble = false)
if (_assemble)
{
stack.assemble();
- if (!stack.errors().empty() && !Error::containsOnlyWarnings(stack.errors()))
- return false;
+ if (!stack.errors().empty())
+ if (!_allowWarnings || !Error::containsOnlyWarnings(stack.errors()))
+ return false;
}
}
catch (FatalError const&)
@@ -67,9 +68,9 @@ bool successParse(std::string const& _source, bool _assemble = false)
return true;
}
-bool successAssemble(string const& _source)
+bool successAssemble(string const& _source, bool _allowWarnings = true)
{
- return successParse(_source, true);
+ return successParse(_source, true, _allowWarnings);
}
}
@@ -169,6 +170,13 @@ BOOST_AUTO_TEST_CASE(magic_variables)
BOOST_CHECK(successAssemble("{ let ecrecover := 1 ecrecover }"));
}
+BOOST_AUTO_TEST_CASE(imbalanced_stack)
+{
+ BOOST_CHECK(successAssemble("{ 1 2 mul pop }", false));
+ BOOST_CHECK(!successAssemble("{ 1 }", false));
+ BOOST_CHECK(successAssemble("{ let x := 4 7 add }", false));
+}
+
BOOST_AUTO_TEST_SUITE_END()
}