Skip to content

Commit

Permalink
Fix vendored dep because upstream is non-responsive
Browse files Browse the repository at this point in the history
Eventually this needs to be fixed in the textflow project by Phil,
but he has not done so in the half a year this bug has been known
to be there, so...

Closes #1470
Closes #1455
  • Loading branch information
horenmar committed Apr 10, 2019
1 parent 1e2270b commit 4e32e0a
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 15 deletions.
3 changes: 3 additions & 0 deletions include/external/clara.hpp
Expand Up @@ -111,6 +111,9 @@ class Column {
m_suffix = false;
auto width = m_column.m_width - indent();
m_end = m_pos;
if (line()[m_pos] == '\n') {
++m_end;
}
while (m_end < line().size() && line()[m_end] != '\n')
++m_end;

Expand Down
5 changes: 4 additions & 1 deletion projects/SelfTest/Baselines/compact.sw.approved.txt
Expand Up @@ -14,6 +14,9 @@ Compilation.tests.cpp:<line number>: passed: std::memcmp(uarr, "123", sizeof(uar
Compilation.tests.cpp:<line number>: passed: std::memcmp(sarr, "456", sizeof(sarr)) == 0 for: 0 == 0 with 2 messages: 'uarr := "123"' and 'sarr := "456"'
Compilation.tests.cpp:<line number>: passed:
Compilation.tests.cpp:<line number>: passed: h1 == h2 for: [1403 helper] == [1403 helper]
Message.tests.cpp:<line number>: warning: '
This info message starts with a linebreak' with 1 message: '
This warning message starts with a linebreak'
This would not be caught previously
Nor would this
Tricky.tests.cpp:<line number>: failed: explicitly with 1 message: '1514'
Expand Down Expand Up @@ -1502,5 +1505,5 @@ Misc.tests.cpp:<line number>: passed: v.size() == 5 for: 5 == 5
Misc.tests.cpp:<line number>: passed: v.capacity() >= 5 for: 5 >= 5
Misc.tests.cpp:<line number>: passed:
Misc.tests.cpp:<line number>: passed:
Failed 77 test cases, failed 138 assertions.
Failed 78 test cases, failed 139 assertions.

16 changes: 13 additions & 3 deletions projects/SelfTest/Baselines/console.std.approved.txt
@@ -1,13 +1,23 @@
Filters: ~[!nonportable]~[!benchmark]~[approvals]
This would not be caught previously
Nor would this

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<exe-name> is a <version> host application.
Run with -? for options

Randomness seeded to: 1

-------------------------------------------------------------------------------
#1455 - INFO and WARN can start with a linebreak
-------------------------------------------------------------------------------
Message.tests.cpp:<line number>
...............................................................................

Message.tests.cpp:<line number>: warning:

This warning message starts with a linebreak

This would not be caught previously
Nor would this
-------------------------------------------------------------------------------
#1514: stderr/stdout is not captured in tests aborted by an exception
-------------------------------------------------------------------------------
Expand Down Expand Up @@ -1265,6 +1275,6 @@ due to unexpected exception with message:
Why would you throw a std::string?

===============================================================================
test cases: 257 | 191 passed | 62 failed | 4 failed as expected
test cases: 258 | 192 passed | 62 failed | 4 failed as expected
assertions: 1419 | 1276 passed | 122 failed | 21 failed as expected

19 changes: 17 additions & 2 deletions projects/SelfTest/Baselines/console.sw.approved.txt
Expand Up @@ -134,6 +134,21 @@ Compilation.tests.cpp:<line number>: PASSED:
with expansion:
[1403 helper] == [1403 helper]

-------------------------------------------------------------------------------
#1455 - INFO and WARN can start with a linebreak
-------------------------------------------------------------------------------
Message.tests.cpp:<line number>
...............................................................................

Message.tests.cpp:<line number>: warning:

This info message starts with a linebreak

This warning message starts with a linebreak


No assertions in test case '#1455 - INFO and WARN can start with a linebreak'

This would not be caught previously
Nor would this
-------------------------------------------------------------------------------
Expand Down Expand Up @@ -11113,6 +11128,6 @@ Misc.tests.cpp:<line number>
Misc.tests.cpp:<line number>: PASSED:

===============================================================================
test cases: 257 | 176 passed | 77 failed | 4 failed as expected
assertions: 1435 | 1276 passed | 138 failed | 21 failed as expected
test cases: 258 | 176 passed | 78 failed | 4 failed as expected
assertions: 1436 | 1276 passed | 139 failed | 21 failed as expected

22 changes: 16 additions & 6 deletions projects/SelfTest/Baselines/console.swa4.approved.txt
Expand Up @@ -134,6 +134,21 @@ Compilation.tests.cpp:<line number>: PASSED:
with expansion:
[1403 helper] == [1403 helper]

-------------------------------------------------------------------------------
#1455 - INFO and WARN can start with a linebreak
-------------------------------------------------------------------------------
Message.tests.cpp:<line number>
...............................................................................

Message.tests.cpp:<line number>: warning:

This info message starts with a linebreak

This warning message starts with a linebreak


No assertions in test case '#1455 - INFO and WARN can start with a linebreak'

This would not be caught previously
Nor would this
-------------------------------------------------------------------------------
Expand Down Expand Up @@ -336,12 +351,7 @@ Condition.tests.cpp:<line number>: FAILED:
Condition.tests.cpp:<line number>: FAILED:
CHECK( true != true )

Condition.tests.cpp:<line number>: FAILED:
CHECK( !true )
with expansion:
false

===============================================================================
test cases: 17 | 13 passed | 2 failed | 2 failed as expected
test cases: 18 | 13 passed | 3 failed | 2 failed as expected
assertions: 40 | 33 passed | 4 failed | 3 failed as expected

3 changes: 2 additions & 1 deletion projects/SelfTest/Baselines/junit.sw.approved.txt
Expand Up @@ -5,7 +5,7 @@
<property name="random-seed" value="1"/>
</properties>
loose text artifact
<testsuite name="<exe-name>" errors="17" failures="122" tests="1436" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<testsuite name="<exe-name>" errors="17" failures="123" tests="1437" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<testcase classname="<exe-name>.global" name="# A test name that starts with a #" time="{duration}"/>
<testcase classname="<exe-name>.global" name="#1005: Comparing pointer to int and long (NULL can be either on various systems)" time="{duration}"/>
<testcase classname="<exe-name>.global" name="#1027" time="{duration}"/>
Expand All @@ -14,6 +14,7 @@ loose text artifact
<testcase classname="<exe-name>.global" name="#1238" time="{duration}"/>
<testcase classname="<exe-name>.(Fixture_1245&lt;int, int>)" name="#1245" time="{duration}"/>
<testcase classname="<exe-name>.global" name="#1403" time="{duration}"/>
<testcase classname="<exe-name>.global" name="#1455 - INFO and WARN can start with a linebreak" time="{duration}"/>
<testcase classname="<exe-name>.global" name="#1514: stderr/stdout is not captured in tests aborted by an exception" time="{duration}">
<failure type="FAIL">
1514
Expand Down
15 changes: 13 additions & 2 deletions projects/SelfTest/Baselines/xml.sw.approved.txt
Expand Up @@ -142,6 +142,17 @@
</Expression>
<OverallResult success="true"/>
</TestCase>
<TestCase name="#1455 - INFO and WARN can start with a linebreak" tags="[.][messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
<Info>

This info message starts with a linebreak
</Info>
<Warning>

This warning message starts with a linebreak
</Warning>
<OverallResult success="false"/>
</TestCase>
<TestCase name="#1514: stderr/stdout is not captured in tests aborted by an exception" tags="[.][output-capture][regression]" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
<Failure filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
1514
Expand Down Expand Up @@ -13388,7 +13399,7 @@ loose text artifact
</Section>
<OverallResult success="true"/>
</TestCase>
<OverallResults successes="1276" failures="139" expectedFailures="21"/>
<OverallResults successes="1276" failures="140" expectedFailures="21"/>
</Group>
<OverallResults successes="1276" failures="138" expectedFailures="21"/>
<OverallResults successes="1276" failures="139" expectedFailures="21"/>
</Catch>
7 changes: 7 additions & 0 deletions projects/SelfTest/UsageTests/Message.tests.cpp
Expand Up @@ -14,6 +14,13 @@ 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( "#1455 - INFO and WARN can start with a linebreak", "[messages][.]" ) {
// Previously these would be hidden from the console reporter output,
// because it would fail at properly reflowing the text
INFO( "\nThis info message starts with a linebreak" );
WARN( "\nThis warning message starts with a linebreak" );
}

TEST_CASE( "SUCCEED counts as a test pass", "[messages]" ) {
SUCCEED( "this is a " << "success" );
}
Expand Down
3 changes: 3 additions & 0 deletions third_party/clara.hpp
Expand Up @@ -110,6 +110,9 @@ namespace clara { namespace TextFlow {
m_suffix = false;
auto width = m_column.m_width-indent();
m_end = m_pos;
if (line()[m_pos] == '\n') {
++m_end;
}
while( m_end < line().size() && line()[m_end] != '\n' )
++m_end;

Expand Down

0 comments on commit 4e32e0a

Please sign in to comment.