The application of interest is a compiler which returns a non-zero exit code when it encounters an error in the source. The unit tests for the compiler are composed of small snippets which intentionally triggers errors.
The function used to add a test is:
function(add_compiler_test test_name options)
add_test(NAME ${test_name}
COMMAND $<TARGET_FILE:pawncc> ${DEFAULT_COMPILER_OPTIONS} ${options})
set_tests_properties(${test_name} PROPERTIES
ENVIRONMENT PATH=$<TARGET_FILE_DIR:pawnc>)
endfunction()
This causes the test to fail when the program returns a non-zero exit code despite that being the correct behaviour.
How can the exit status of the program be tested?