Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:02:52

0001 
0002 //              Copyright Catch2 Authors
0003 // Distributed under the Boost Software License, Version 1.0.
0004 //   (See accompanying file LICENSE.txt or copy at
0005 //        https://www.boost.org/LICENSE_1_0.txt)
0006 
0007 // SPDX-License-Identifier: BSL-1.0
0008 #ifndef CATCH_REPORTER_TEAMCITY_HPP_INCLUDED
0009 #define CATCH_REPORTER_TEAMCITY_HPP_INCLUDED
0010 
0011 #include <catch2/reporters/catch_reporter_streaming_base.hpp>
0012 #include <catch2/catch_timer.hpp>
0013 
0014 #include <cstring>
0015 
0016 #ifdef __clang__
0017 #   pragma clang diagnostic push
0018 #   pragma clang diagnostic ignored "-Wpadded"
0019 #endif
0020 
0021 namespace Catch {
0022 
0023     class TeamCityReporter final : public StreamingReporterBase {
0024     public:
0025         TeamCityReporter( ReporterConfig&& _config )
0026         :   StreamingReporterBase( CATCH_MOVE(_config) )
0027         {
0028             m_preferences.shouldRedirectStdOut = true;
0029         }
0030 
0031         ~TeamCityReporter() override;
0032 
0033         static std::string getDescription() {
0034             using namespace std::string_literals;
0035             return "Reports test results as TeamCity service messages"s;
0036         }
0037 
0038         void testRunStarting( TestRunInfo const& groupInfo ) override;
0039         void testRunEnded( TestRunStats const& testGroupStats ) override;
0040 
0041 
0042         void assertionEnded(AssertionStats const& assertionStats) override;
0043 
0044         void sectionStarting(SectionInfo const& sectionInfo) override {
0045             m_headerPrintedForThisSection = false;
0046             StreamingReporterBase::sectionStarting( sectionInfo );
0047         }
0048 
0049         void testCaseStarting(TestCaseInfo const& testInfo) override;
0050 
0051         void testCaseEnded(TestCaseStats const& testCaseStats) override;
0052 
0053     private:
0054         void printSectionHeader(std::ostream& os);
0055 
0056         bool m_headerPrintedForThisSection = false;
0057         Timer m_testTimer;
0058     };
0059 
0060 } // end namespace Catch
0061 
0062 #ifdef __clang__
0063 #   pragma clang diagnostic pop
0064 #endif
0065 
0066 #endif // CATCH_REPORTER_TEAMCITY_HPP_INCLUDED