mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
refactor(test): use single executable
This commit is contained in:
parent
c0d84853ea
commit
8c41aaae04
@ -1,4 +1,3 @@
|
||||
#define CATCH_CONFIG_RUNNER
|
||||
#include "util/SafeSignal.hpp"
|
||||
|
||||
#include <glibmm.h>
|
||||
@ -138,8 +137,3 @@ TEST_CASE_METHOD(GlibTestsFixture, "SafeSignal copy/move counter", "[signal][thr
|
||||
producer.join();
|
||||
REQUIRE(count == NUM_EVENTS);
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
Glib::init();
|
||||
return Catch::Session().run(argc, argv);
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
#define CATCH_CONFIG_MAIN
|
||||
#include "config.hpp"
|
||||
|
||||
#include <catch2/catch.hpp>
|
||||
|
26
test/main.cpp
Normal file
26
test/main.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#define CATCH_CONFIG_RUNNER
|
||||
#include <glibmm.h>
|
||||
#include <spdlog/sinks/stdout_sinks.h>
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
#include <catch2/catch.hpp>
|
||||
#include <catch2/catch_reporter_tap.hpp>
|
||||
#include <memory>
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
Catch::Session session;
|
||||
Glib::init();
|
||||
|
||||
session.applyCommandLine(argc, argv);
|
||||
const auto logger = spdlog::default_logger();
|
||||
const auto& reporter_name = session.config().getReporterName();
|
||||
if (reporter_name == "tap") {
|
||||
spdlog::set_pattern("# [%l] %v");
|
||||
} else if (reporter_name == "compact") {
|
||||
logger->sinks().clear();
|
||||
} else {
|
||||
logger->sinks().assign({std::make_shared<spdlog::sinks::stderr_sink_st>()});
|
||||
}
|
||||
|
||||
return session.run();
|
||||
}
|
@ -7,29 +7,18 @@ test_dep = [
|
||||
spdlog,
|
||||
]
|
||||
|
||||
config_test = executable(
|
||||
'config_test',
|
||||
waybar_test = executable(
|
||||
'waybar_test',
|
||||
'main.cpp',
|
||||
'SafeSignal.cpp',
|
||||
'config.cpp',
|
||||
'../src/config.cpp',
|
||||
dependencies: test_dep,
|
||||
include_directories: test_inc,
|
||||
)
|
||||
|
||||
safesignal_test = executable(
|
||||
'safesignal_test',
|
||||
'SafeSignal.cpp',
|
||||
dependencies: test_dep,
|
||||
include_directories: test_inc,
|
||||
)
|
||||
|
||||
test(
|
||||
'Configuration test',
|
||||
config_test,
|
||||
workdir: meson.source_root(),
|
||||
)
|
||||
|
||||
test(
|
||||
'SafeSignal test',
|
||||
safesignal_test,
|
||||
'waybar',
|
||||
waybar_test,
|
||||
workdir: meson.source_root(),
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user