Files
panopainter/tests/cmake/expect_pano_cli_apply_stroke_script_failure.cmake

37 lines
979 B
CMake

if(NOT DEFINED PANO_CLI)
message(FATAL_ERROR "PANO_CLI must be set")
endif()
if(NOT DEFINED STROKE_SCRIPT)
message(FATAL_ERROR "STROKE_SCRIPT must be set")
endif()
if(NOT DEFINED OUTPUT_PATH)
message(FATAL_ERROR "OUTPUT_PATH must be set")
endif()
if(NOT DEFINED EXPECTED_OUTPUT)
message(FATAL_ERROR "EXPECTED_OUTPUT must be set")
endif()
execute_process(
COMMAND "${PANO_CLI}" apply-stroke-script
--path "${STROKE_SCRIPT}"
--output "${OUTPUT_PATH}"
--width 7
--height 32
RESULT_VARIABLE result
OUTPUT_VARIABLE output
ERROR_VARIABLE error)
if(result EQUAL 0)
message(FATAL_ERROR "Expected pano_cli apply-stroke-script to fail, but it exited 0")
endif()
set(combined_output "${output}${error}")
string(FIND "${combined_output}" "${EXPECTED_OUTPUT}" expected_index)
if(expected_index LESS 0)
message(FATAL_ERROR
"Expected output to contain '${EXPECTED_OUTPUT}', got: ${combined_output}")
endif()