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 Catch {
namespace { 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 { class TapAssertionPrinter {
static constexpr StringRef failedString = "not ok"_sr;
static constexpr StringRef passedString = "ok"_sr;
public: public:
TapAssertionPrinter& operator= (TapAssertionPrinter const&) = delete; TapAssertionPrinter& operator= (TapAssertionPrinter const&) = delete;
TapAssertionPrinter(TapAssertionPrinter const&) = delete; TapAssertionPrinter(TapAssertionPrinter const&) = delete;
@ -31,7 +34,7 @@ namespace Catch {
switch (result.getResultType()) { switch (result.getResultType()) {
case ResultWas::Ok: case ResultWas::Ok:
printResultType(passedString); printResultType(tapPassedString);
printOriginalExpression(); printOriginalExpression();
printReconstructedExpression(); printReconstructedExpression();
if (!result.hasExpression()) if (!result.hasExpression())
@ -41,9 +44,9 @@ namespace Catch {
break; break;
case ResultWas::ExpressionFailed: case ResultWas::ExpressionFailed:
if (result.isOk()) { if (result.isOk()) {
printResultType(passedString); printResultType(tapPassedString);
} else { } else {
printResultType(failedString); printResultType(tapFailedString);
} }
printOriginalExpression(); printOriginalExpression();
printReconstructedExpression(); printReconstructedExpression();
@ -53,21 +56,21 @@ namespace Catch {
printRemainingMessages(); printRemainingMessages();
break; break;
case ResultWas::ThrewException: case ResultWas::ThrewException:
printResultType(failedString); printResultType(tapFailedString);
printIssue("unexpected exception with message:"_sr); printIssue("unexpected exception with message:"_sr);
printMessage(); printMessage();
printExpressionWas(); printExpressionWas();
printRemainingMessages(); printRemainingMessages();
break; break;
case ResultWas::FatalErrorCondition: case ResultWas::FatalErrorCondition:
printResultType(failedString); printResultType(tapFailedString);
printIssue("fatal error condition with message:"_sr); printIssue("fatal error condition with message:"_sr);
printMessage(); printMessage();
printExpressionWas(); printExpressionWas();
printRemainingMessages(); printRemainingMessages();
break; break;
case ResultWas::DidntThrowException: case ResultWas::DidntThrowException:
printResultType(failedString); printResultType(tapFailedString);
printIssue("expected exception, got none"_sr); printIssue("expected exception, got none"_sr);
printExpressionWas(); printExpressionWas();
printRemainingMessages(); printRemainingMessages();
@ -83,7 +86,7 @@ namespace Catch {
printRemainingMessages(); printRemainingMessages();
break; break;
case ResultWas::ExplicitFailure: case ResultWas::ExplicitFailure:
printResultType(failedString); printResultType(tapFailedString);
printIssue("explicitly"_sr); printIssue("explicitly"_sr);
printRemainingMessages(Colour::None); printRemainingMessages(Colour::None);
break; break;
@ -185,9 +188,6 @@ namespace Catch {
std::size_t counter; std::size_t counter;
}; };
constexpr StringRef TapAssertionPrinter::failedString;
constexpr StringRef TapAssertionPrinter::passedString;
} // End anonymous namespace } // End anonymous namespace
TAPReporter::~TAPReporter() {} TAPReporter::~TAPReporter() {}