mirror of
https://github.com/catchorg/Catch2.git
synced 2024-12-23 03:43:28 +01:00
Console reporter: Don't print full path for every line
This commit is contained in:
parent
6fb8260add
commit
6488fc1c88
@ -80,10 +80,7 @@ namespace Catch {
|
||||
|
||||
lazyPrint();
|
||||
|
||||
if( !result.getSourceInfo().empty() ) {
|
||||
TextColour colour( TextColour::FileName );
|
||||
stream << result.getSourceInfo();
|
||||
}
|
||||
printLineInfo( result.getSourceInfo() );
|
||||
|
||||
if( result.hasExpression() ) {
|
||||
TextColour colour( TextColour::OriginalExpression );
|
||||
@ -241,6 +238,7 @@ namespace Catch {
|
||||
}
|
||||
|
||||
virtual void sectionEnded( Ptr<SectionStats const> const& _sectionStats ) {
|
||||
resetLastPrintedLine();
|
||||
if( _sectionStats->missingAssertions ) {
|
||||
lazyPrint();
|
||||
TextColour colour( TextColour::ResultError );
|
||||
@ -263,6 +261,7 @@ namespace Catch {
|
||||
AccumulatingReporter::sectionEnded( _sectionStats );
|
||||
}
|
||||
virtual void testCaseEnded( Ptr<TestCaseStats const> const& _testCaseStats ) {
|
||||
resetLastPrintedLine();
|
||||
if( _testCaseStats->missingAssertions ) {
|
||||
lazyPrint();
|
||||
TextColour colour( TextColour::ResultError );
|
||||
@ -292,6 +291,26 @@ namespace Catch {
|
||||
AccumulatingReporter::testRunEnded( _testRunStats );
|
||||
}
|
||||
|
||||
void printLineInfo( SourceLineInfo const& lineInfo ) {
|
||||
if( !lineInfo.empty() ) {
|
||||
if( m_lastPrintedLine.empty() ||
|
||||
m_lastPrintedLine.file != lineInfo.file ||
|
||||
abs( static_cast<int>( m_lastPrintedLine.line ) - static_cast<int>( lineInfo.line ) ) > 20 ) {
|
||||
TextColour colour( TextColour::FileName );
|
||||
stream << lineInfo << "\n";
|
||||
m_lastPrintedLine = lineInfo;
|
||||
}
|
||||
else if( lineInfo.line != m_lastPrintedLine.line ) {
|
||||
TextColour colour( TextColour::FileName );
|
||||
stream << "line " << lineInfo.line << ":\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
void resetLastPrintedLine() {
|
||||
m_lastPrintedLine = SourceLineInfo();
|
||||
}
|
||||
SourceLineInfo m_lastPrintedLine;
|
||||
|
||||
};
|
||||
|
||||
INTERNAL_CATCH_REGISTER_REPORTER( "console", ConsoleReporter )
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -564,7 +564,7 @@
|
||||
CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++98";
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = NO;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = "";
|
||||
GCC_PREPROCESSOR_DEFINITIONS = CATCH_CONFIG_USE_ANSI_COLOUR_CODES;
|
||||
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
WARNING_CFLAGS = (
|
||||
|
Loading…
Reference in New Issue
Block a user