srctree

Robin Linden parent 3c8920d3 ee095094
etest: Drop support for etest_with_main

etest_with_main was added because at first I was planning on being fullycompatible with gtest, but I like this more. If a user wants somethinglike etest_with_main, they can very easily build it on top of etestthemselves.

inlinesplit
etest/BUILD added: 8, removed: 42, total 0
@@ -10,26 +10,9 @@ cc_library(
visibility = ["//visibility:public"],
)
 
cc_library(
name = "etest_with_main",
srcs = ["etest_main.cpp"],
visibility = ["//visibility:public"],
deps = [":etest"],
)
 
cc_test(
name = "etest_test",
size = "small",
srcs = ["etest_test.cpp"],
deps = [":etest_with_main"],
)
 
[cc_test(
name = src[:-4],
size = "small",
srcs = [src],
deps = [":etest"],
) for src in glob(
include = ["*_test.cpp"],
exclude = ["etest_test.cpp"],
)]
) for src in glob(["*_test.cpp"])]
 
etest/etest.cpp added: 8, removed: 42, total 0
@@ -67,9 +67,8 @@ int run_all_tests() noexcept {
return assertion_failures > 0 ? 1 : 0;
}
 
int test(std::string_view name, std::function<void()> body) noexcept {
void test(std::string_view name, std::function<void()> body) noexcept {
registry().push_back({name, body});
return 0;
}
 
void expect(bool b, etest::source_location const &loc) noexcept {
 
etest/etest.h added: 8, removed: 42, total 0
@@ -20,7 +20,7 @@ concept Printable = requires(std::ostream &os, T t) {
};
 
int run_all_tests() noexcept;
int test(std::string_view name, std::function<void()> body) noexcept;
void test(std::string_view name, std::function<void()> body) noexcept;
 
// Weak test requirement. Allows the test to continue even if the check fails.
void expect(bool, etest::source_location const &loc = etest::source_location::current()) noexcept;
 
ev/null added: 8, removed: 42, total 0
@@ -1,9 +0,0 @@
// SPDX-FileCopyrightText: 2021 Robin Lindén <dev@robinlinden.eu>
//
// SPDX-License-Identifier: BSD-2-Clause
 
#include "etest/etest.h"
 
int main() {
return etest::run_all_tests();
}
 
ev/null added: 8, removed: 42, total 0
@@ -1,7 +0,0 @@
// SPDX-FileCopyrightText: 2021 Robin Lindén <dev@robinlinden.eu>
//
// SPDX-License-Identifier: BSD-2-Clause
 
#include "etest/etest.h"
 
auto test0 = etest::test("expect true works", [] { etest::expect(true); });