Fix bad indentation calculation in the console reporter

The problem came from the console reporter trying to provide a
fancy linebreaking (primarily for things like `SCENARIO` or the
BDD macros), so that new lines start with extra indentation if
the text being line broken starts as "{text}: ".

The console reporter did not properly take into account cases
where the ": " part would already be in a later line, in which
case it would ask for non-sensical level of indentation (larger
than single line length).

We fixed this by also enforcing that the special indentation case
only triggers if the ": " is found early enough in the line, so
that we also avoid degenerate cases like this:
```
blablabla: F
           a
           n
           c
           y
           .
           .
           .
```

Fixes #2309
This commit is contained in:
Martin Hořeňovský
2021-10-25 15:10:35 +02:00
parent 0fdee1c273
commit 905bf438ae
11 changed files with 63 additions and 16 deletions

View File

@@ -12248,6 +12248,9 @@ All available test cases:
</Section>
<OverallResult success="true"/>
</TestCase>
<TestCase name="Reproducer for #2309 - a very long description past 80 chars (default console width) with a late colon : blablabla" tags="[console-reporter]" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" >
<OverallResult success="true"/>
</TestCase>
<TestCase name="SUCCEED counts as a test pass" tags="[messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
<OverallResult success="true"/>
</TestCase>
@@ -20027,6 +20030,6 @@ loose text artifact
</Section>
<OverallResult success="true"/>
</TestCase>
<OverallResults successes="1958" failures="146" expectedFailures="27"/>
<OverallResultsCases successes="279" failures="86" expectedFailures="7"/>
<OverallResults successes="1959" failures="146" expectedFailures="27"/>
<OverallResultsCases successes="280" failures="86" expectedFailures="7"/>
</Catch2TestRun>