srctree

Robin Linden parent 393eb92b 651949d3
etest: Clean up testing of disabled tests

etest/disabled_test_test.cpp added: 9, removed: 5, total 4
@@ -1,20 +1,24 @@
// SPDX-FileCopyrightText: 2022 Robin Lindén <dev@robinlinden.eu>
// SPDX-FileCopyrightText: 2022-2023 Robin Lindén <dev@robinlinden.eu>
//
// SPDX-License-Identifier: BSD-2-Clause
 
#include "etest/etest.h"
 
#include <iostream>
#include <tuple>
 
int main() {
etest::disabled_test("hi", [] { etest::expect(false); });
bool ran{};
etest::disabled_test("hi", [&] { ran = true; });
 
if (etest::run_all_tests() != 0) {
std::ignore = etest::run_all_tests();
if (ran) {
std::cerr << "A disabled test ran when it shouldn't have\n";
return 1;
}
 
if (etest::run_all_tests({.run_disabled_tests = true}) == 0) {
std::ignore = etest::run_all_tests({.run_disabled_tests = true});
if (!ran) {
std::cerr << "A disabled test didn't run when it should have\n";
return 1;
}