neovim/cmake/RunUnittests.cmake
John Szakmeister 7cb20fd1b0 Generate a lua module to help pass build-related settings.
This allows us to avoid hard-coding paths and using environment
variables to communicate key information to unit tests, which fits
with the overall goal of making sure that folks driving CMake directly
can continue to do out-of-tree builds.
2014-05-03 10:36:54 -04:00

15 lines
416 B
CMake

get_filename_component(BUSTED_DIR ${BUSTED_PRG} PATH)
set(ENV{PATH} "${BUSTED_DIR}:$ENV{PATH}")
if(DEFINED ENV{TEST_FILE})
set(TEST_DIR $ENV{TEST_FILE})
endif()
execute_process(
COMMAND ${BUSTED_PRG} -o ${BUSTED_OUTPUT_TYPE} --lpath=${BUILD_DIR}/?.lua --pattern=.moon ${TEST_DIR}
WORKING_DIRECTORY ${WORKING_DIR}
RESULT_VARIABLE res)
if(NOT res EQUAL 0)
message(FATAL_ERROR "Unit tests failed.")
endif()