Skip to content

Commit

Permalink
fix: unix tests && linter
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-olivier committed Jul 21, 2024
1 parent ec2ea13 commit 59c6de5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
10 changes: 6 additions & 4 deletions src/unix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@
* This library is released under MIT license
*/

#include <cxxabi.h>
#include <cstring>
#include <string>
#include <cxxabi.h>

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()) {
Expand All @@ -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, '&');
Expand Down Expand Up @@ -65,4 +67,4 @@ std::string get_demangled_name(const char *symbol) {
free(res);

return result;
}
}
2 changes: 1 addition & 1 deletion tests/tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ TEST(filesystem, basic_test) {

TEST(cpp_symbols, basic_test) {
dylib lib("./", "dynamic_lib");

auto mean = lib.get_variable<double>("meaning_of_life");
EXPECT_EQ(mean, 42);

Expand Down

0 comments on commit 59c6de5

Please sign in to comment.