#
# Unit tests for the LtsCommandLineParser module.
# One test executable per module, each registered with ctest.
#
if (NOT BUILD_TESTING)
  return()
endif()

# --- LtsCommandLineParser: option registration, parsing, domain id handling
if (TARGET LtsCommandLineParser)
  # probe helper: runs init() with a real command line (QtTest's main cannot
  # forward CLI options); used by iniFileProvidesDomainId
  ADD_EXECUTABLE(commandlineparser_ini_probe commandlineparser_ini_probe.cpp)
  TARGET_LINK_LIBRARIES(commandlineparser_ini_probe
    LtsCommandLineParser
    Qt6::Core
  )

  ADD_EXECUTABLE(commandlineparser_unit_test commandlineparser_unit_test.cpp)
  ADD_DEPENDENCIES(commandlineparser_unit_test commandlineparser_ini_probe)
  TARGET_COMPILE_DEFINITIONS(commandlineparser_unit_test PRIVATE
    INI_PROBE_EXE="$<TARGET_FILE:commandlineparser_ini_probe>")
  TARGET_LINK_LIBRARIES(commandlineparser_unit_test
    LtsCommandLineParser
    Qt6::Core
    Qt6::Test
  )
  ADD_TEST(NAME commandlineparser_unit_test COMMAND $<TARGET_FILE:commandlineparser_unit_test>)
endif()
