2022-01-08 03:59:08 +01:00
|
|
|
#define CATCH_CONFIG_RUNNER
|
|
|
|
#include <glibmm.h>
|
|
|
|
#include <spdlog/sinks/stdout_sinks.h>
|
|
|
|
#include <spdlog/spdlog.h>
|
|
|
|
|
2023-01-16 20:04:56 +01:00
|
|
|
#if __has_include(<catch2/catch_all.hpp>)
|
2022-10-16 15:51:43 +02:00
|
|
|
#include <catch2/catch_all.hpp>
|
|
|
|
#include <catch2/reporters/catch_reporter_tap.hpp>
|
2023-01-16 20:04:56 +01:00
|
|
|
#else
|
|
|
|
#include <catch2/catch.hpp>
|
|
|
|
#include <catch2/catch_reporter_tap.hpp>
|
|
|
|
#endif
|
2022-01-08 03:59:08 +01:00
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
int main(int argc, char* argv[]) {
|
|
|
|
Catch::Session session;
|
|
|
|
Glib::init();
|
|
|
|
|
|
|
|
session.applyCommandLine(argc, argv);
|
2022-04-06 08:37:19 +02:00
|
|
|
const auto logger = spdlog::default_logger();
|
2023-01-16 20:04:56 +01:00
|
|
|
#if CATCH_VERSION_MAJOR >= 3
|
2022-10-16 15:51:43 +02:00
|
|
|
for (const auto& spec : session.config().getReporterSpecs()) {
|
2023-01-16 20:04:56 +01:00
|
|
|
const auto& reporter_name = spec.name();
|
|
|
|
#else
|
|
|
|
{
|
|
|
|
const auto& reporter_name = session.config().getReporterName();
|
|
|
|
#endif
|
|
|
|
if (reporter_name == "tap") {
|
2022-10-16 15:51:43 +02:00
|
|
|
spdlog::set_pattern("# [%l] %v");
|
2023-01-16 20:04:56 +01:00
|
|
|
} else if (reporter_name == "compact") {
|
2022-10-16 15:51:43 +02:00
|
|
|
logger->sinks().clear();
|
|
|
|
} else {
|
|
|
|
logger->sinks().assign({std::make_shared<spdlog::sinks::stderr_sink_st>()});
|
|
|
|
}
|
2022-01-08 03:59:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return session.run();
|
|
|
|
}
|