# C tests for csrc/term, built apart from the extension: `make test-c`.
# test_pty and test_session run real children headless; test_view drives the
# widget through a windowless CUI context.
cmake_minimum_required(VERSION 3.19)  # libghostty-vt's CMake wrapper needs 3.19
project(cui_py_repl_tests LANGUAGES C)

set(CUI_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(CUI_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(CUI_BUILD_SHARED OFF CACHE BOOL "" FORCE)
add_subdirectory(../../thirdparty/cui cui EXCLUDE_FROM_ALL)
add_subdirectory(../../csrc/term term)

enable_testing()
foreach(t pty session view)
    add_executable(test_${t} test_${t}.c)
    target_compile_options(test_${t} PRIVATE -Wall -Wextra -Wshadow -Wstrict-prototypes)
    target_link_libraries(test_${t} PRIVATE cuiterm)
    add_test(NAME ${t} COMMAND test_${t})
endforeach()
