aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/solidityExecutionFramework.h
diff options
context:
space:
mode:
authorLianaHus <liana@ethdev.com>2015-10-15 02:37:41 +0800
committerLianaHus <liana@ethdev.com>2015-10-15 02:37:41 +0800
commitc3491e446964f366101f28e3d51ab59dd9aaa5b2 (patch)
tree75a261126d7c0eb7919db32603aea44e5fe443ba /test/libsolidity/solidityExecutionFramework.h
parent8f7f22c5a6b1a71d7baff489b6425670550e8e8b (diff)
downloaddexon-solidity-c3491e446964f366101f28e3d51ab59dd9aaa5b2.tar.gz
dexon-solidity-c3491e446964f366101f28e3d51ab59dd9aaa5b2.tar.zst
dexon-solidity-c3491e446964f366101f28e3d51ab59dd9aaa5b2.zip
errors instead of exceptions
Conflicts: libsolidity/CompilerStack.cpp libsolidity/NameAndTypeResolver.cpp libsolidity/NameAndTypeResolver.h libsolidity/TypeChecker.cpp test/libsolidity/SolidityNameAndTypeResolution.cpp
Diffstat (limited to 'test/libsolidity/solidityExecutionFramework.h')
-rw-r--r--test/libsolidity/solidityExecutionFramework.h20
1 files changed, 17 insertions, 3 deletions
diff --git a/test/libsolidity/solidityExecutionFramework.h b/test/libsolidity/solidityExecutionFramework.h
index 3370044c..27dd4fb7 100644
--- a/test/libsolidity/solidityExecutionFramework.h
+++ b/test/libsolidity/solidityExecutionFramework.h
@@ -67,12 +67,26 @@ public:
return m_output;
}
- template <class Exceptiontype>
- void compileRequireThrow(std::string const& _sourceCode)
+ void compileRequireError(std::string const& _sourceCode, Error::Type _type)
{
m_compiler.reset(false, m_addStandardSources);
m_compiler.addSource("", _sourceCode);
- BOOST_REQUIRE_THROW(m_compiler.compile(m_optimize, m_optimizeRuns), Exceptiontype);
+ bool foundError = false;
+ try
+ {
+ m_compiler.compile(m_optimize, m_optimizeRuns);
+ BOOST_REQUIRE(Error::containsErrorOfType(m_compiler.errors(), _type));
+ }
+ catch(Error const& _e)
+ {
+ BOOST_REQUIRE(_e.type() == _type);
+ foundError = true;
+ }
+ catch(Exception const& _exception)
+ {
+ BOOST_REQUIRE(false);
+ }
+ BOOST_REQUIRE(foundError);
}
bytes const& compileAndRun(