From ec2fccf6b80b4dbbc0f18f77ec9fee556cca34b5 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Mon, 24 Sep 2012 08:28:23 +0100 Subject: [PATCH] Fixed SCOPED_INFO (#123) --- include/internal/catch_capture.hpp | 4 ++-- include/internal/catch_runner_impl.hpp | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/include/internal/catch_capture.hpp b/include/internal/catch_capture.hpp index c4f28757..379cc24c 100644 --- a/include/internal/catch_capture.hpp +++ b/include/internal/catch_capture.hpp @@ -35,8 +35,8 @@ public: return *this; } - std::string getInfo () const { - return m_oss.str(); + ResultInfo getInfo () const { + return ResultInfo( "", ResultWas::Info, false, SourceLineInfo(), "SCOPED_INFO", m_oss.str().c_str() ); } private: diff --git a/include/internal/catch_runner_impl.hpp b/include/internal/catch_runner_impl.hpp index 578d26dd..314182f4 100644 --- a/include/internal/catch_runner_impl.hpp +++ b/include/internal/catch_runner_impl.hpp @@ -156,10 +156,18 @@ namespace Catch { else if( !result.ok() ) { m_totals.assertions.failed++; - std::vector::const_iterator it = m_info.begin(); - std::vector::const_iterator itEnd = m_info.end(); - for(; it != itEnd; ++it ) - m_reporter->Result( *it ); + { + std::vector::const_iterator it = m_scopedInfos.begin(); + std::vector::const_iterator itEnd = m_scopedInfos.end(); + for(; it != itEnd; ++it ) + m_reporter->Result( (*it)->getInfo() ); + } + { + std::vector::const_iterator it = m_info.begin(); + std::vector::const_iterator itEnd = m_info.end(); + for(; it != itEnd; ++it ) + m_reporter->Result( *it ); + } m_info.clear(); }