@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2021-2023 Robin Lindén <dev@robinlinden.eu>
// SPDX-FileCopyrightText: 2021-2024 Robin Lindén <dev@robinlinden.eu>
//
// SPDX-License-Identifier: BSD-2-Clause
@@ -20,12 +20,7 @@ Suite ®istry() {
return test_registry;
}
struct DummyActions : public IActions {
void expect(bool, std::optional<std::string_view>, etest::source_location const &) noexcept override {}
void require(bool, std::optional<std::string_view>, etest::source_location const &) override {}
};
DummyActions dummy_actions;
std::reference_wrapper<IActions> current_actions{dummy_actions};
std::optional<std::reference_wrapper<IActions>> current_actions{};
} // namespace
int run_all_tests(RunOptions const &opts) noexcept {
@@ -47,11 +42,11 @@ void disabled_test(std::string name, std::function<void()> body) noexcept {
}
void expect(bool b, std::optional<std::string_view> log_message, etest::source_location const &loc) noexcept {
current_actions.get().expect(b, std::move(log_message), loc);
current_actions.value().get().expect(b, std::move(log_message), loc);
}
void require(bool b, std::optional<std::string_view> log_message, etest::source_location const &loc) {
current_actions.get().require(b, std::move(log_message), loc);
current_actions.value().get().require(b, std::move(log_message), loc);
}
} // namespace etest