diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/libjulia/Common.cpp | 8 | ||||
-rw-r--r-- | test/libsolidity/GasMeter.cpp | 6 | ||||
-rw-r--r-- | test/libsolidity/SolidityExecutionFramework.h | 9 |
3 files changed, 13 insertions, 10 deletions
diff --git a/test/libjulia/Common.cpp b/test/libjulia/Common.cpp index e1ab8215..00336977 100644 --- a/test/libjulia/Common.cpp +++ b/test/libjulia/Common.cpp @@ -40,12 +40,12 @@ using namespace dev::solidity; void dev::julia::test::printErrors(ErrorList const& _errors, Scanner const& _scanner) { + SourceReferenceFormatter formatter(cout, [&](std::string const&) -> Scanner const& { return _scanner; }); + for (auto const& error: _errors) - SourceReferenceFormatter::printExceptionInformation( - cout, + formatter.printExceptionInformation( *error, - (error->type() == Error::Type::Warning) ? "Warning" : "Error", - [&](std::string const&) -> Scanner const& { return _scanner; } + (error->type() == Error::Type::Warning) ? "Warning" : "Error" ); } diff --git a/test/libsolidity/GasMeter.cpp b/test/libsolidity/GasMeter.cpp index 86e8201b..9d3409dd 100644 --- a/test/libsolidity/GasMeter.cpp +++ b/test/libsolidity/GasMeter.cpp @@ -136,8 +136,10 @@ BOOST_AUTO_TEST_CASE(non_overlapping_filtered_costs) { BOOST_CHECK_MESSAGE(false, "Source locations should not overlap!"); auto scannerFromSource = [&](string const& _sourceName) -> Scanner const& { return m_compiler.scanner(_sourceName); }; - SourceReferenceFormatter::printSourceLocation(cout, &first->first->location(), scannerFromSource); - SourceReferenceFormatter::printSourceLocation(cout, &second->first->location(), scannerFromSource); + SourceReferenceFormatter formatter(cout, scannerFromSource); + + formatter.printSourceLocation(&first->first->location()); + formatter.printSourceLocation(&second->first->location()); } } } diff --git a/test/libsolidity/SolidityExecutionFramework.h b/test/libsolidity/SolidityExecutionFramework.h index b0daaba9..b853d558 100644 --- a/test/libsolidity/SolidityExecutionFramework.h +++ b/test/libsolidity/SolidityExecutionFramework.h @@ -60,12 +60,13 @@ public: m_compiler.setOptimiserSettings(m_optimize, m_optimizeRuns); if (!m_compiler.compile()) { + auto scannerFromSourceName = [&](std::string const& _sourceName) -> solidity::Scanner const& { return m_compiler.scanner(_sourceName); }; + SourceReferenceFormatter formatter(std::cerr, scannerFromSourceName); + for (auto const& error: m_compiler.errors()) - SourceReferenceFormatter::printExceptionInformation( - std::cerr, + formatter.printExceptionInformation( *error, - (error->type() == Error::Type::Warning) ? "Warning" : "Error", - [&](std::string const& _sourceName) -> solidity::Scanner const& { return m_compiler.scanner(_sourceName); } + (error->type() == Error::Type::Warning) ? "Warning" : "Error" ); BOOST_ERROR("Compiling contract failed"); } |