diff options
Diffstat (limited to 'tests/framework/printers')
-rw-r--r-- | tests/framework/printers/JSONPrinter.cpp | 10 | ||||
-rw-r--r-- | tests/framework/printers/JSONPrinter.h | 1 | ||||
-rw-r--r-- | tests/framework/printers/PrettyPrinter.cpp | 5 | ||||
-rw-r--r-- | tests/framework/printers/PrettyPrinter.h | 1 | ||||
-rw-r--r-- | tests/framework/printers/Printer.h | 6 |
5 files changed, 23 insertions, 0 deletions
diff --git a/tests/framework/printers/JSONPrinter.cpp b/tests/framework/printers/JSONPrinter.cpp index 5b30389eca..bf8fce7844 100644 --- a/tests/framework/printers/JSONPrinter.cpp +++ b/tests/framework/printers/JSONPrinter.cpp @@ -113,6 +113,16 @@ void JSONPrinter::print_error(const std::exception &error) } } +void JSONPrinter::print_info(const std::string &info) +{ + std::istringstream iss(info); + for(std::string line; !std::getline(iss, line).fail();) + { + print_separator(_first_error); + *_stream << R"(")" << line << R"(")"; + } +} + void JSONPrinter::print_measurements(const Profiler::MeasurementsMap &measurements) { print_separator(_first_test_entry); diff --git a/tests/framework/printers/JSONPrinter.h b/tests/framework/printers/JSONPrinter.h index 14c8b35cb9..18bd4380b0 100644 --- a/tests/framework/printers/JSONPrinter.h +++ b/tests/framework/printers/JSONPrinter.h @@ -48,6 +48,7 @@ public: void print_errors_header() override; void print_errors_footer() override; void print_error(const std::exception &error) override; + void print_info(const std::string &info) override; void print_measurements(const Profiler::MeasurementsMap &measurements) override; private: diff --git a/tests/framework/printers/PrettyPrinter.cpp b/tests/framework/printers/PrettyPrinter.cpp index ec32e5296e..b0892a4a50 100644 --- a/tests/framework/printers/PrettyPrinter.cpp +++ b/tests/framework/printers/PrettyPrinter.cpp @@ -96,6 +96,11 @@ void PrettyPrinter::print_errors_footer() { } +void PrettyPrinter::print_info(const std::string &info) +{ + *_stream << begin_color("1") << "INFO: " << info << end_color() << "\n"; +} + void PrettyPrinter::print_error(const std::exception &error) { *_stream << begin_color("1") << "ERROR: " << error.what() << end_color() << "\n"; diff --git a/tests/framework/printers/PrettyPrinter.h b/tests/framework/printers/PrettyPrinter.h index fa7b7b2c59..3e2bebd1f7 100644 --- a/tests/framework/printers/PrettyPrinter.h +++ b/tests/framework/printers/PrettyPrinter.h @@ -54,6 +54,7 @@ public: void print_errors_header() override; void print_errors_footer() override; void print_error(const std::exception &error) override; + void print_info(const std::string &info) override; void print_measurements(const Profiler::MeasurementsMap &measurements) override; private: diff --git a/tests/framework/printers/Printer.h b/tests/framework/printers/Printer.h index 198d84d466..16a4170d7a 100644 --- a/tests/framework/printers/Printer.h +++ b/tests/framework/printers/Printer.h @@ -108,6 +108,12 @@ public: */ virtual void print_error(const std::exception &error) = 0; + /** Print test log info. + * + * @param[in] info Description of the log. + */ + virtual void print_info(const std::string &info) = 0; + /** Print measurements for a test. * * @param[in] measurements Measurements as collected by a @ref Profiler. |