From 59c6de545942d19e521c2726b09e4a7d17ab3702 Mon Sep 17 00:00:00 2001 From: Martin Olivier Date: Sun, 21 Jul 2024 20:40:28 +0200 Subject: [PATCH] fix: unix tests && linter --- .github/workflows/CI.yml | 2 +- src/unix.cpp | 10 ++++++---- tests/tests.cpp | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index a872150..8fbfb33 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -63,7 +63,7 @@ jobs: - name: Run unit tests working-directory: build - run: ctest + run: ctest --verbose - name: Generate code coverage if: ${{ matrix.os == 'ubuntu-latest' && matrix.cxx-std == 20 }} diff --git a/src/unix.cpp b/src/unix.cpp index a27f3a9..a772ff9 100644 --- a/src/unix.cpp +++ b/src/unix.cpp @@ -7,14 +7,13 @@ * This library is released under MIT license */ +#include #include #include -#include void replace_occurrences(std::string &input, const std::string &keyword, const std::string &replacement); -static void add_sym_separator(std::string &input, char symbol) -{ +static void add_sym_separator(std::string &input, char symbol) { size_t pos = 0; if (input.empty()) { @@ -35,7 +34,10 @@ std::string format_symbol(std::string input) { replace_occurrences(input, "std::__1::", "std::"); replace_occurrences(input, "std::__cxx11::", "std::"); + replace_occurrences(input, "[abi:cxx11]", ""); + replace_occurrences(input, "()", "(void)"); + replace_occurrences(input, "> >", ">>"); add_sym_separator(input, '*'); add_sym_separator(input, '&'); @@ -65,4 +67,4 @@ std::string get_demangled_name(const char *symbol) { free(res); return result; -} \ No newline at end of file +} diff --git a/tests/tests.cpp b/tests/tests.cpp index c34b380..1bc94c5 100755 --- a/tests/tests.cpp +++ b/tests/tests.cpp @@ -186,7 +186,7 @@ TEST(filesystem, basic_test) { TEST(cpp_symbols, basic_test) { dylib lib("./", "dynamic_lib"); - + auto mean = lib.get_variable("meaning_of_life"); EXPECT_EQ(mean, 42);