From d8d9419092efe189bef5403a74b7bcdca4c59235 Mon Sep 17 00:00:00 2001 From: TheVice Date: Wed, 15 Dec 2021 21:38:09 +0200 Subject: [PATCH] Fix shared library tests for Windows (#1074) Add copying of shared library to the output directory with a test binary. [binary] removed using of non unsigned char as argument at 'std::isspace' function that was provokes undefined behavior. [.github/workflows/build.yml] enabled run of test at the 'windows-latest' environment. --- .github/workflows/build.yml | 2 +- src/binary.cpp | 2 +- test/CMakeLists.txt | 7 +++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0565fe1..56419f2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,7 +33,7 @@ jobs: cmake --build . --parallel 4 # tests are failing for unknown reasons - - if: matrix.os == 'ubuntu-latest' + - if: matrix.os != 'macos-latest' name: Test shared shell: bash run: cd build && ctest --output-on-failure diff --git a/src/binary.cpp b/src/binary.cpp index 5949dd3..d27762a 100644 --- a/src/binary.cpp +++ b/src/binary.cpp @@ -75,7 +75,7 @@ std::vector DecodeBase64(const std::string &input) { unsigned value = 0; for (std::size_t i = 0, cnt = 0; i < input.size(); i++) { - if (std::isspace(input[i])) { + if (std::isspace(static_cast(input[i]))) { // skip newlines continue; } diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 5ebc1a6..6118b7f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -47,3 +47,10 @@ endif() add_test(yaml-cpp::test yaml-cpp-tests) + +if (build-windows-dll) + add_custom_command( + TARGET yaml-cpp-tests + POST_BUILD COMMAND ${CMAKE_COMMAND} -E + copy_if_different "$" "$") +endif()