diff options
author | Brad King <brad.king@kitware.com> | 2020-09-29 10:24:00 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-09-29 10:24:51 (GMT) |
commit | edd60d4419774684b12ac6fed633e3357c3b57a3 (patch) | |
tree | 22509ba98cbf68a59e637ed1b81c4022e212ea90 /Tests/RunCMake/cmake_language | |
parent | 1a5bf8245e19450c5e04221affa1a7f3994bdb63 (diff) | |
download | CMake-edd60d4419774684b12ac6fed633e3357c3b57a3.zip CMake-edd60d4419774684b12ac6fed633e3357c3b57a3.tar.gz CMake-edd60d4419774684b12ac6fed633e3357c3b57a3.tar.bz2 |
Tests: Simplify RunCMake.cmake_language invalid command cases
Diffstat (limited to 'Tests/RunCMake/cmake_language')
5 files changed, 16 insertions, 17 deletions
diff --git a/Tests/RunCMake/cmake_language/CallInvalidCommand.cmake b/Tests/RunCMake/cmake_language/CallInvalidCommand.cmake deleted file mode 100644 index 8bee6f2..0000000 --- a/Tests/RunCMake/cmake_language/CallInvalidCommand.cmake +++ /dev/null @@ -1,2 +0,0 @@ - -cmake_language(CALL ${COMMAND}) diff --git a/Tests/RunCMake/cmake_language/RunCMakeTest.cmake b/Tests/RunCMake/cmake_language/RunCMakeTest.cmake index 5fb93c8..29a4d23 100644 --- a/Tests/RunCMake/cmake_language/RunCMakeTest.cmake +++ b/Tests/RunCMake/cmake_language/RunCMakeTest.cmake @@ -2,7 +2,16 @@ include(RunCMake) run_cmake(no_parameters) run_cmake(unknown_meta_operation) -run_cmake(call_invalid_command) +foreach(command IN ITEMS + "function" "ENDFUNCTION" + "macro" "endMACRO" + "if" "elseif" "else" "endif" + "while" "endwhile" + "foreach" "endforeach" + ) + message(STATUS "Running call_invalid_command for ${command}...") + run_cmake_with_options(call_invalid_command -Dcommand=${command}) +endforeach() run_cmake(call_valid_command) run_cmake(call_double_evaluation) run_cmake(call_expanded_command) diff --git a/Tests/RunCMake/cmake_language/call_invalid_command-result.txt b/Tests/RunCMake/cmake_language/call_invalid_command-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_invalid_command-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/call_invalid_command-stderr.txt b/Tests/RunCMake/cmake_language/call_invalid_command-stderr.txt new file mode 100644 index 0000000..4439842 --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_invalid_command-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at call_invalid_command.cmake:1 \(cmake_language\): + cmake_language invalid command specified: [A-Za-z_]+ +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/cmake_language/call_invalid_command.cmake b/Tests/RunCMake/cmake_language/call_invalid_command.cmake index 585aad4..f213895 100644 --- a/Tests/RunCMake/cmake_language/call_invalid_command.cmake +++ b/Tests/RunCMake/cmake_language/call_invalid_command.cmake @@ -1,14 +1 @@ - -foreach (command IN ITEMS "function" "ENDFUNCTION" - "macro" "endMACRO" - "if" "elseif" "else" "endif" - "while" "endwhile" - "foreach" "endforeach") - execute_process(COMMAND "${CMAKE_COMMAND}" -DCOMMAND=${command} - -P "${CMAKE_CURRENT_SOURCE_DIR}/CallInvalidCommand.cmake" - OUTPUT_QUIET ERROR_QUIET - RESULT_VARIABLE result) - if (NOT result) - message (SEND_ERROR "cmake_language(CALL ${command}) unexpectedly successful.") - endif() -endforeach() +cmake_language(CALL ${command}) |