diff --git a/include/external/clara.hpp b/include/external/clara.hpp index 056e0a3152..06920a055b 100644 --- a/include/external/clara.hpp +++ b/include/external/clara.hpp @@ -111,7 +111,10 @@ class Column { m_suffix = false; auto width = m_column.m_width - indent(); m_end = m_pos; + if(!line().empty() && line()[m_pos] == '\n') + ++m_end; while (m_end < line().size() && line()[m_end] != '\n') + // while (m_end < line().size()) ++m_end; if (m_end < m_pos + width) { diff --git a/projects/SelfTest/Baselines/compact.sw.approved.txt b/projects/SelfTest/Baselines/compact.sw.approved.txt index 1b32b42e96..0977959f5b 100644 --- a/projects/SelfTest/Baselines/compact.sw.approved.txt +++ b/projects/SelfTest/Baselines/compact.sw.approved.txt @@ -453,6 +453,9 @@ Approx.tests.cpp:: passed: d >= Approx( 1.23 ) for: 1.23 >= Approx( Approx.tests.cpp:: passed: !(d >= Approx( 1.24 )) for: !(1.23 >= Approx( 1.24 )) Approx.tests.cpp:: passed: d >= Approx( 1.24 ).epsilon(0.1) for: 1.23 >= Approx( 1.24 ) Message.tests.cpp:: warning: 'this is a message' with 1 message: 'this is a warning' +Message.tests.cpp:: warning: ' +this is a message start with a linebreak' with 1 message: ' +this is a warning start with a linebreak' Message.tests.cpp:: failed: a == 1 for: 2 == 1 with 2 messages: 'this message should be logged' and 'so should this' Message.tests.cpp:: passed: a == 2 for: 2 == 2 with 1 message: 'this message may be logged later' Message.tests.cpp:: failed: a == 1 for: 2 == 1 with 2 messages: 'this message may be logged later' and 'this message should be logged' @@ -1389,5 +1392,5 @@ Misc.tests.cpp:: passed: v.size() == 5 for: 5 == 5 Misc.tests.cpp:: passed: v.capacity() >= 5 for: 5 >= 5 Misc.tests.cpp:: passed: Misc.tests.cpp:: passed: -Failed 65 test cases, failed 125 assertions. +Failed 66 test cases, failed 126 assertions. diff --git a/projects/SelfTest/Baselines/console.std.approved.txt b/projects/SelfTest/Baselines/console.std.approved.txt index 5e82417e30..3e193dd0e1 100644 --- a/projects/SelfTest/Baselines/console.std.approved.txt +++ b/projects/SelfTest/Baselines/console.std.approved.txt @@ -437,6 +437,16 @@ Message.tests.cpp: Message.tests.cpp:: warning: this is a warning +------------------------------------------------------------------------------- +INFO and WARN start with a linebreak +------------------------------------------------------------------------------- +Message.tests.cpp: +............................................................................... + +Message.tests.cpp:: warning: + +this is a warning start with a linebreak + ------------------------------------------------------------------------------- INFO gets logged on failure ------------------------------------------------------------------------------- @@ -1126,6 +1136,6 @@ due to unexpected exception with message: Why would you throw a std::string? =============================================================================== -test cases: 228 | 172 passed | 52 failed | 4 failed as expected +test cases: 229 | 173 passed | 52 failed | 4 failed as expected assertions: 1310 | 1178 passed | 111 failed | 21 failed as expected diff --git a/projects/SelfTest/Baselines/console.sw.approved.txt b/projects/SelfTest/Baselines/console.sw.approved.txt index 286384258b..1fa456ce07 100644 --- a/projects/SelfTest/Baselines/console.sw.approved.txt +++ b/projects/SelfTest/Baselines/console.sw.approved.txt @@ -3668,6 +3668,21 @@ Message.tests.cpp:: warning: No assertions in test case 'INFO and WARN do not abort tests' +------------------------------------------------------------------------------- +INFO and WARN start with a linebreak +------------------------------------------------------------------------------- +Message.tests.cpp: +............................................................................... + +Message.tests.cpp:: warning: + +this is a message start with a linebreak + +this is a warning start with a linebreak + + +No assertions in test case 'INFO and WARN start with a linebreak' + ------------------------------------------------------------------------------- INFO gets logged on failure ------------------------------------------------------------------------------- @@ -10464,6 +10479,6 @@ Misc.tests.cpp: Misc.tests.cpp:: PASSED: =============================================================================== -test cases: 228 | 159 passed | 65 failed | 4 failed as expected -assertions: 1324 | 1178 passed | 125 failed | 21 failed as expected +test cases: 229 | 159 passed | 66 failed | 4 failed as expected +assertions: 1325 | 1178 passed | 126 failed | 21 failed as expected diff --git a/projects/SelfTest/Baselines/junit.sw.approved.txt b/projects/SelfTest/Baselines/junit.sw.approved.txt index cb03cdb790..8a81c642b8 100644 --- a/projects/SelfTest/Baselines/junit.sw.approved.txt +++ b/projects/SelfTest/Baselines/junit.sw.approved.txt @@ -1,7 +1,7 @@ - + @@ -321,6 +321,7 @@ Message.tests.cpp: + this message should be logged diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt index 7e02b772ea..8d749c73cc 100644 --- a/projects/SelfTest/Baselines/xml.sw.approved.txt +++ b/projects/SelfTest/Baselines/xml.sw.approved.txt @@ -3980,6 +3980,17 @@ + + + +this is a message start with a linebreak + + + +this is a warning start with a linebreak + + + this message should be logged @@ -12099,7 +12110,7 @@ loose text artifact - + - + diff --git a/projects/SelfTest/UsageTests/Message.tests.cpp b/projects/SelfTest/UsageTests/Message.tests.cpp index 002fb875ae..4093a38113 100644 --- a/projects/SelfTest/UsageTests/Message.tests.cpp +++ b/projects/SelfTest/UsageTests/Message.tests.cpp @@ -14,6 +14,11 @@ TEST_CASE( "INFO and WARN do not abort tests", "[messages][.]" ) { WARN( "this is a " << "warning" ); // This should always output the message but then continue } +TEST_CASE( "INFO and WARN start with a linebreak", "[messages][.]" ) { + INFO( "\nthis is a " << "message start with a linebreak" ); + WARN( "\nthis is a " << "warning start with a linebreak" ); +} + TEST_CASE( "SUCCEED counts as a test pass", "[messages]" ) { SUCCEED( "this is a " << "success" ); }