Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run the test cases with ctest #54

Merged
merged 2 commits into from
Sep 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ jobs:
mkdir build
cmake -DCMAKE_BUILD_TYPE=Release -DLIBREADTAGS_BUILD_SHARED=ON -S . -B build
cmake --build build --target readtags
- run:
name: Build test cases
command: |
cmake --build build
- run:
name: Run the test cases
command: |
ctest --test-dir build || cat build/Testing/Temporary/LastTest.log
- run:
name: Install
command: |
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.deps
.libs
*.a
*.gcda
*.gcno
*.gcov
Expand Down Expand Up @@ -46,3 +47,5 @@ tests/test-fix-unescaping-input-fields-exuberant
tests/test-fix-unescaping-input-fields-no-mode
tests/test-fix-unescaping-input-fields-backslash
tests/test-fix-unescaping-input-fields-no-filesep

build
31 changes: 29 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,35 @@ endif ()
add_library(universal-ctags::${PROJECT_NAME} ALIAS ${PROJECT_NAME})

target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

enable_testing()
set(test_cases
test-api-tagsOpen
test-api-tagsFind
test-api-tagsFindPseudoTag
test-api-tagsFirstPseudoTag
test-api-tagsFirst
test-api-tagsClose
test-api-tagsSetSortType

test-fix-unescaping
test-fix-null-deref
test-fix-large-tags
test-fix-unescaping-input-fields
test-fix-unescaping-input-fields-exuberant
test-fix-unescaping-input-fields-no-mode
test-fix-unescaping-input-fields-backslash
test-fix-unescaping-input-fields-no-filesep
)

foreach(t IN LISTS test_cases)
add_executable(${t} tests/${t}.c)
target_link_libraries(${t} readtags)
add_test(NAME ${t}
COMMAND ${t}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tests)
endforeach()

#
# TODO:
#
Expand All @@ -58,5 +87,3 @@ target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
# Finding Packages. But if you use CMake method FetchContent to add
# libreadtags to your project, then current changes should be enough.
#
# * Running test cases
#
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ cmake -DCMAKE_BUILD_TYPE=Release -DLIBREADTAGS_BUILD_SHARED=ON -S . -B build
cmake --build build --target readtags
```

#### Configure, build, and test
```shell
mkdir build
cmake -DCMAKE_BUILD_TYPE=Release -DLIBREADTAGS_BUILD_SHARED=ON -S . -B build
cmake --build build
ctest --test-dir build
```

#### Configure and install

This will install the library and headers to `/usr/local`.
Expand Down
Loading