Skip to content

Commit

Permalink
update tests to run jsoncpp
Browse files Browse the repository at this point in the history
  • Loading branch information
prince-chrismc committed Dec 21, 2023
1 parent 65cda08 commit 675b97b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
7 changes: 6 additions & 1 deletion .github/actions/render/tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,15 @@ runs:
const { TRAITS_NAME, SUITE_NAME } = process.env
console.log(`Rendering ${TRAITS_NAME}!`)
// https://dmitripavlutin.com/replace-all-string-occurrences-javascript/
function replaceAll(string, search, replace) {
return string.split(search).join(replace);
}
const template = fs.readFileSync(path.join('tests', 'traits', 'TraitsTest.cpp.mustache'), 'utf8')
const content = mustache.render(template, {
traits_name: TRAITS_NAME,
traits_dir: TRAITS_NAME.replace('_', '-'),
traits_dir: replaceAll(TRAITS_NAME, '_', '-'),
test_suite_name: SUITE_NAME,
})
const outputDir = path.join('tests', 'traits')
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/jwt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
- uses: ./.github/actions/install/gtest
- uses: ./.github/actions/install/danielaparker-jsoncons
- uses: ./.github/actions/install/boost-json
- uses: ./.github/actions/install/open-source-parsers-jsoncpp

- name: configure
run: |
Expand Down
3 changes: 3 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ else()
if(TARGET boost_json)
target_link_libraries(jwt-cpp-test PRIVATE boost_json)
endif()
if(TARGET jsoncpp_static)
target_link_libraries(jwt-cpp-test PRIVATE jsoncpp_static)
endif()
endif()
target_link_libraries(jwt-cpp-test PRIVATE jwt-cpp nlohmann_json::nlohmann_json
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:${CMAKE_DL_LIBS}>)
Expand Down
2 changes: 1 addition & 1 deletion tests/traits/OspJsoncppTest.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "jwt-cpp/traits/open-source_parsers_jsoncpp/traits.h"
#include "jwt-cpp/traits/open-source-parsers-jsoncpp/traits.h"

#include <gtest/gtest.h>

Expand Down

0 comments on commit 675b97b

Please sign in to comment.