mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-25 23:06:10 +01:00
Fix infinite loop in compact reporter printer
Also simplify some variables with auto deduction.
This commit is contained in:
parent
cf55cfd76f
commit
3d9e7db2e0
@ -209,24 +209,25 @@ private:
|
|||||||
if (itMessage == messages.end())
|
if (itMessage == messages.end())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// using messages.end() directly yields (or auto) compilation error:
|
const auto itEnd = messages.cend();
|
||||||
std::vector<MessageInfo>::const_iterator itEnd = messages.end();
|
const auto N = static_cast<std::size_t>(std::distance(itMessage, itEnd));
|
||||||
const std::size_t N = static_cast<std::size_t>(std::distance(itMessage, itEnd));
|
|
||||||
|
|
||||||
{
|
{
|
||||||
Colour colourGuard(colour);
|
Colour colourGuard(colour);
|
||||||
stream << " with " << pluralise(N, "message") << ':';
|
stream << " with " << pluralise(N, "message") << ':';
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; itMessage != itEnd; ) {
|
while (itMessage != itEnd) {
|
||||||
// If this assertion is a warning ignore any INFO messages
|
// If this assertion is a warning ignore any INFO messages
|
||||||
if (printInfoMessages || itMessage->type != ResultWas::Info) {
|
if (printInfoMessages || itMessage->type != ResultWas::Info) {
|
||||||
stream << " '" << itMessage->message << '\'';
|
printMessage();
|
||||||
if (++itMessage != itEnd) {
|
if (itMessage != itEnd) {
|
||||||
Colour colourGuard(dimColour());
|
Colour colourGuard(dimColour());
|
||||||
stream << " and";
|
stream << " and";
|
||||||
}
|
}
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
++itMessage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user