Tap reporter changes

This commit is contained in:
Martin Hořeňovský 2020-05-12 15:40:39 +02:00
parent 2528247351
commit eb267b424b
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A

View File

@ -12,9 +12,12 @@
namespace Catch {
namespace {
// Yes, this has to be outside the class and namespaced by naming.
// Making older compiler happy is hard.
static constexpr StringRef tapFailedString = "not ok"_sr;
static constexpr StringRef tapPassedString = "ok"_sr;
class TapAssertionPrinter {
static constexpr StringRef failedString = "not ok"_sr;
static constexpr StringRef passedString = "ok"_sr;
public:
TapAssertionPrinter& operator= (TapAssertionPrinter const&) = delete;
TapAssertionPrinter(TapAssertionPrinter const&) = delete;
@ -31,7 +34,7 @@ namespace Catch {
switch (result.getResultType()) {
case ResultWas::Ok:
printResultType(passedString);
printResultType(tapPassedString);
printOriginalExpression();
printReconstructedExpression();
if (!result.hasExpression())
@ -41,9 +44,9 @@ namespace Catch {
break;
case ResultWas::ExpressionFailed:
if (result.isOk()) {
printResultType(passedString);
printResultType(tapPassedString);
} else {
printResultType(failedString);
printResultType(tapFailedString);
}
printOriginalExpression();
printReconstructedExpression();
@ -53,21 +56,21 @@ namespace Catch {
printRemainingMessages();
break;
case ResultWas::ThrewException:
printResultType(failedString);
printResultType(tapFailedString);
printIssue("unexpected exception with message:"_sr);
printMessage();
printExpressionWas();
printRemainingMessages();
break;
case ResultWas::FatalErrorCondition:
printResultType(failedString);
printResultType(tapFailedString);
printIssue("fatal error condition with message:"_sr);
printMessage();
printExpressionWas();
printRemainingMessages();
break;
case ResultWas::DidntThrowException:
printResultType(failedString);
printResultType(tapFailedString);
printIssue("expected exception, got none"_sr);
printExpressionWas();
printRemainingMessages();
@ -83,7 +86,7 @@ namespace Catch {
printRemainingMessages();
break;
case ResultWas::ExplicitFailure:
printResultType(failedString);
printResultType(tapFailedString);
printIssue("explicitly"_sr);
printRemainingMessages(Colour::None);
break;
@ -185,9 +188,6 @@ namespace Catch {
std::size_t counter;
};
constexpr StringRef TapAssertionPrinter::failedString;
constexpr StringRef TapAssertionPrinter::passedString;
} // End anonymous namespace
TAPReporter::~TAPReporter() {}