Skip to content

Commit

Permalink
coveralls
Browse files Browse the repository at this point in the history
  • Loading branch information
ednolan committed Aug 24, 2024
1 parent e411878 commit eea2787
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 5 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@ jobs:
submodules: recursive
- name: Run
run: |
./ci.sh -DCMAKE_CXX_FLAGS='-fsanitize=address -fsanitize=undefined -fsanitize-undefined-trap-on-error'
./ci.sh -DCMAKE_CXX_FLAGS='-fsanitize=address -fsanitize=undefined -fsanitize-undefined-trap-on-error -coverage'
- name: Coverage
run: lcov --directory ./build --capture --output-file ./build/coverage.info
- name: Coveralls
uses: coverallsapp/github-action@master
with:
path-to-lcov: ${{runner.workspace}}/build/coverage.info
github-token: ${{ secrets.GITHUB_TOKEN }}
clang-linux:
runs-on: ubuntu-latest
container:
Expand Down
1 change: 1 addition & 0 deletions src/UtfView/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ add_library(
utfview_test_lib
STATIC
concepts.t.cpp
framework.cpp
null_term.t.cpp
std_archetypes/exposition_only.t.cpp
std_archetypes/iterator.t.cpp
Expand Down
16 changes: 16 additions & 0 deletions src/UtfView/tests/framework.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <functional>
#include <map>
#include <string>

namespace utfview::tests {

namespace framework {

std::map<std::string, std::move_only_function<bool()>>& tests() {
static std::map<std::string, std::move_only_function<bool()>> result{};
return result;
}

} // namespace framework

} // namespace utfview::tests
13 changes: 13 additions & 0 deletions src/UtfView/tests/framework.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include <functional>
#include <map>
#include <string>

namespace utfview::tests {

namespace framework {

std::map<std::string, std::move_only_function<bool()>>& tests();

} // namespace framework

} // namespace utfview::tests
13 changes: 12 additions & 1 deletion src/UtfView/tests/main.t.cpp
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
int main() { }
#include <cstdlib>
#include <iostream>
#include <tests/framework.hpp>

int main() {
for (auto& [test_name, test] : utfview::tests::framework::tests()) {
if (!test()) {
std::cerr << test_name << " failed";
return EXIT_FAILURE;
}
}
}
5 changes: 2 additions & 3 deletions src/UtfView/tests/utf_view.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <iterator>
#include <ranges>
#include <string>
#include <tests/framework.hpp>

namespace utfview::tests {

Expand Down Expand Up @@ -480,9 +481,7 @@ namespace utfview::tests {
#endif

static auto const init{[] {
if (!utf_view_test()) {
std::abort();
}
framework::tests().insert({"utf_view_test", &utf_view_test});
struct {
} result{};
return result;
Expand Down

0 comments on commit eea2787

Please sign in to comment.