🧪 test: register remaining tests in ctest

This commit is contained in:
csh 2025-12-21 15:52:09 +08:00
parent f2d2aeb272
commit fbf6c85baa
6 changed files with 40 additions and 0 deletions

View File

@ -40,3 +40,15 @@ endif()
if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/test_provider/CMakeLists.txt)
add_subdirectory(test_provider)
endif()
if(BUILD_TESTS)
find_program(PYTHON3_EXECUTABLE python3)
if(PYTHON3_EXECUTABLE)
add_test(NAME test_lsp_json
COMMAND ${PYTHON3_EXECUTABLE}
${CMAKE_CURRENT_LIST_DIR}/run_lsp_json_tests.py
--server $<TARGET_FILE:tsl-server>)
else()
message(WARNING "python3 not found; skipping test_lsp_json registration")
endif()
endif()

View File

@ -65,3 +65,8 @@ target_compile_options(
${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic $<$<CONFIG:Debug>:-g -O0>
-Wno-import-implementation-partition-unit-in-interface-unit
$<$<CONFIG:Release>:-O3>)
if(BUILD_TESTS)
add_test(NAME test_lsp_any
COMMAND $<TARGET_FILE:test_lsp_any>)
endif()

View File

@ -28,3 +28,8 @@ target_compile_options(
-Wall -Wextra -Wpedantic $<$<CONFIG:Debug>:-g -O0>
-Wno-import-implementation-partition-unit-in-interface-unit
$<$<CONFIG:Release>:-O3>)
if(BUILD_TESTS)
add_test(NAME test_module
COMMAND $<TARGET_FILE:test_module>)
endif()

View File

@ -210,3 +210,8 @@ target_compile_options(
PRIVATE -Wall -Wextra -Wpedantic $<$<CONFIG:Debug>:-g -O0>
-Wno-import-implementation-partition-unit-in-interface-unit
$<$<CONFIG:Release>:-O3>)
if(BUILD_TESTS)
add_test(NAME test_provider
COMMAND $<TARGET_FILE:test_provider>)
endif()

View File

@ -44,3 +44,8 @@ target_compile_options(
PRIVATE -Wall -Wextra -Wpedantic $<$<CONFIG:Debug>:-g -O0>
-Wno-import-implementation-partition-unit-in-interface-unit
$<$<CONFIG:Release>:-O3>)
if(BUILD_TESTS)
add_test(NAME test_scheduler
COMMAND $<TARGET_FILE:test_scheduler>)
endif()

View File

@ -120,3 +120,11 @@ target_compile_options(
-Wall -Wextra -Wpedantic $<$<CONFIG:Debug>:-g -O0>
-Wno-import-implementation-partition-unit-in-interface-unit
$<$<CONFIG:Release>:-O3>)
if(BUILD_TESTS)
add_test(NAME test_semantic_script
COMMAND ${CMAKE_COMMAND} -E env
TEST_SEMANTIC_OVERRIDE=$<TARGET_FILE:test_semantic>
BUILD_PRESET=ctest
bash ${CMAKE_CURRENT_SOURCE_DIR}/test.sh)
endif()