diff options
Diffstat (limited to 'Tests/RunCMake/cmake_language')
54 files changed, 141 insertions, 0 deletions
diff --git a/Tests/RunCMake/cmake_language/CMakeLists.txt b/Tests/RunCMake/cmake_language/CMakeLists.txt new file mode 100644 index 0000000..2632ffa --- /dev/null +++ b/Tests/RunCMake/cmake_language/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.16) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/cmake_language/RunCMakeTest.cmake b/Tests/RunCMake/cmake_language/RunCMakeTest.cmake new file mode 100644 index 0000000..c556e42 --- /dev/null +++ b/Tests/RunCMake/cmake_language/RunCMakeTest.cmake @@ -0,0 +1,23 @@ +include(RunCMake) + +run_cmake(no_parameters) +run_cmake(unknown_meta_operation) +run_cmake(call_double_evaluation) +run_cmake(call_expanded_command) +run_cmake(call_expanded_command_and_arguments) +run_cmake(call_expanded_command_with_explicit_argument) +run_cmake(call_expand_command_name) +run_cmake(call_expand_function_name) +run_cmake(call_message) +run_cmake(call_message_fatal_error) +run_cmake(call_no_parameters) +run_cmake(call_preserve_arguments) +run_cmake(call_unknown_function) +run_cmake(eval_expand_command_name) +run_cmake(eval_expanded_command_and_arguments) +run_cmake(eval_extra_parameters_between_eval_and_code) +run_cmake(eval_message) +run_cmake(eval_message_fatal_error) +run_cmake(eval_no_code) +run_cmake(eval_no_parameters) +run_cmake(eval_variable_outside_message) diff --git a/Tests/RunCMake/cmake_language/call_double_evaluation-stderr.txt b/Tests/RunCMake/cmake_language/call_double_evaluation-stderr.txt new file mode 100644 index 0000000..59a70bd --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_double_evaluation-stderr.txt @@ -0,0 +1 @@ +var='\${foo}' diff --git a/Tests/RunCMake/cmake_language/call_double_evaluation.cmake b/Tests/RunCMake/cmake_language/call_double_evaluation.cmake new file mode 100644 index 0000000..cf8fc91 --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_double_evaluation.cmake @@ -0,0 +1,2 @@ +set(var [[${foo}]]) +cmake_language(CALL cmake_language CALL message "var='${var}'") diff --git a/Tests/RunCMake/cmake_language/call_expand_command_name-stderr.txt b/Tests/RunCMake/cmake_language/call_expand_command_name-stderr.txt new file mode 100644 index 0000000..d640661 --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_expand_command_name-stderr.txt @@ -0,0 +1 @@ +OK! diff --git a/Tests/RunCMake/cmake_language/call_expand_command_name.cmake b/Tests/RunCMake/cmake_language/call_expand_command_name.cmake new file mode 100644 index 0000000..e03bb1f --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_expand_command_name.cmake @@ -0,0 +1,2 @@ +set (my_call "CALL") +cmake_language (${my_call} message "OK!") diff --git a/Tests/RunCMake/cmake_language/call_expand_function_name-stderr.txt b/Tests/RunCMake/cmake_language/call_expand_function_name-stderr.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_expand_function_name-stderr.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/call_expand_function_name.cmake b/Tests/RunCMake/cmake_language/call_expand_function_name.cmake new file mode 100644 index 0000000..565a7df --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_expand_function_name.cmake @@ -0,0 +1,11 @@ +function(some_function_1) + message(1) +endfunction() + +function(some_function_2) + message(2) +endfunction() + +set(function_version 1) + +cmake_language(CALL some_function_${function_version}) diff --git a/Tests/RunCMake/cmake_language/call_expanded_command-stderr.txt b/Tests/RunCMake/cmake_language/call_expanded_command-stderr.txt new file mode 100644 index 0000000..d640661 --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_expanded_command-stderr.txt @@ -0,0 +1 @@ +OK! diff --git a/Tests/RunCMake/cmake_language/call_expanded_command.cmake b/Tests/RunCMake/cmake_language/call_expanded_command.cmake new file mode 100644 index 0000000..e76e612 --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_expanded_command.cmake @@ -0,0 +1,6 @@ +function (itsok) + message(OK!) +endfunction() + +set (cmd CALL itsok) +cmake_language (${cmd}) diff --git a/Tests/RunCMake/cmake_language/call_expanded_command_and_arguments-result.txt b/Tests/RunCMake/cmake_language/call_expanded_command_and_arguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_expanded_command_and_arguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/call_expanded_command_and_arguments-stderr.txt b/Tests/RunCMake/cmake_language/call_expanded_command_and_arguments-stderr.txt new file mode 100644 index 0000000..e87e9bc --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_expanded_command_and_arguments-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at call_expanded_command_and_arguments.cmake:2 \(cmake_language\): + cmake_language called with incorrect number of arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/cmake_language/call_expanded_command_and_arguments.cmake b/Tests/RunCMake/cmake_language/call_expanded_command_and_arguments.cmake new file mode 100644 index 0000000..4ce6b34 --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_expanded_command_and_arguments.cmake @@ -0,0 +1,2 @@ +set(call_message CALL message a b) +cmake_language(${call_message}) diff --git a/Tests/RunCMake/cmake_language/call_expanded_command_with_explicit_argument-stderr.txt b/Tests/RunCMake/cmake_language/call_expanded_command_with_explicit_argument-stderr.txt new file mode 100644 index 0000000..d640661 --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_expanded_command_with_explicit_argument-stderr.txt @@ -0,0 +1 @@ +OK! diff --git a/Tests/RunCMake/cmake_language/call_expanded_command_with_explicit_argument.cmake b/Tests/RunCMake/cmake_language/call_expanded_command_with_explicit_argument.cmake new file mode 100644 index 0000000..0563400 --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_expanded_command_with_explicit_argument.cmake @@ -0,0 +1,2 @@ +set (cmd CALL message) +cmake_language (${cmd} "OK!") diff --git a/Tests/RunCMake/cmake_language/call_message-stderr.txt b/Tests/RunCMake/cmake_language/call_message-stderr.txt new file mode 100644 index 0000000..cfc8694 --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_message-stderr.txt @@ -0,0 +1 @@ +WORKS! diff --git a/Tests/RunCMake/cmake_language/call_message.cmake b/Tests/RunCMake/cmake_language/call_message.cmake new file mode 100644 index 0000000..31aefdf --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_message.cmake @@ -0,0 +1 @@ +cmake_language(CALL message WORKS!) diff --git a/Tests/RunCMake/cmake_language/call_message_fatal_error-result.txt b/Tests/RunCMake/cmake_language/call_message_fatal_error-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_message_fatal_error-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/call_message_fatal_error-stderr.txt b/Tests/RunCMake/cmake_language/call_message_fatal_error-stderr.txt new file mode 100644 index 0000000..83eb3d8 --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_message_fatal_error-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at call_message_fatal_error.cmake:1 \(message\): + error! +Call Stack \(most recent call first\): + call_message_fatal_error.cmake:1 \(cmake_language\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/cmake_language/call_message_fatal_error.cmake b/Tests/RunCMake/cmake_language/call_message_fatal_error.cmake new file mode 100644 index 0000000..935b437 --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_message_fatal_error.cmake @@ -0,0 +1 @@ +cmake_language(CALL message FATAL_ERROR error!) diff --git a/Tests/RunCMake/cmake_language/call_no_parameters-result.txt b/Tests/RunCMake/cmake_language/call_no_parameters-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_no_parameters-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/call_no_parameters-stderr.txt b/Tests/RunCMake/cmake_language/call_no_parameters-stderr.txt new file mode 100644 index 0000000..9e2c08f --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_no_parameters-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at call_no_parameters.cmake:1 \(cmake_language\): + cmake_language called with incorrect number of arguments diff --git a/Tests/RunCMake/cmake_language/call_no_parameters.cmake b/Tests/RunCMake/cmake_language/call_no_parameters.cmake new file mode 100644 index 0000000..8353e08 --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_no_parameters.cmake @@ -0,0 +1 @@ +cmake_language(CALL) diff --git a/Tests/RunCMake/cmake_language/call_preserve_arguments-stderr.txt b/Tests/RunCMake/cmake_language/call_preserve_arguments-stderr.txt new file mode 100644 index 0000000..8ec5483 --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_preserve_arguments-stderr.txt @@ -0,0 +1,6 @@ +foo\(...\) +\[a;b\] +\[c;d\] +cmake_language\(CALL foo ...\) +\[a;b\] +\[c;d\] diff --git a/Tests/RunCMake/cmake_language/call_preserve_arguments.cmake b/Tests/RunCMake/cmake_language/call_preserve_arguments.cmake new file mode 100644 index 0000000..bfef0fd --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_preserve_arguments.cmake @@ -0,0 +1,12 @@ +function(foo arg1 arg2) + math(EXPR last "${ARGC} - 1") + foreach(i RANGE 0 ${last}) + message("[${ARGV${i}}]") + endforeach() +endfunction() + +message("foo(...)") +foo("a;b" "c;d") + +message("cmake_language(CALL foo ...)") +cmake_language(CALL foo "a;b" "c;d") diff --git a/Tests/RunCMake/cmake_language/call_unknown_function-result.txt b/Tests/RunCMake/cmake_language/call_unknown_function-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_unknown_function-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/call_unknown_function-stderr.txt b/Tests/RunCMake/cmake_language/call_unknown_function-stderr.txt new file mode 100644 index 0000000..d09e708 --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_unknown_function-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at call_unknown_function.cmake:1 \(unknown\): + Unknown CMake command "unknown". diff --git a/Tests/RunCMake/cmake_language/call_unknown_function.cmake b/Tests/RunCMake/cmake_language/call_unknown_function.cmake new file mode 100644 index 0000000..efd6baf --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_unknown_function.cmake @@ -0,0 +1 @@ +cmake_language(CALL unknown) diff --git a/Tests/RunCMake/cmake_language/eval_expand_command_name-stderr.txt b/Tests/RunCMake/cmake_language/eval_expand_command_name-stderr.txt new file mode 100644 index 0000000..d640661 --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_expand_command_name-stderr.txt @@ -0,0 +1 @@ +OK! diff --git a/Tests/RunCMake/cmake_language/eval_expand_command_name.cmake b/Tests/RunCMake/cmake_language/eval_expand_command_name.cmake new file mode 100644 index 0000000..2397232 --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_expand_command_name.cmake @@ -0,0 +1,2 @@ +set (my_eval "EVAL") +cmake_language (${my_eval} CODE message("OK!")) diff --git a/Tests/RunCMake/cmake_language/eval_expanded_command_and_arguments-stderr.txt b/Tests/RunCMake/cmake_language/eval_expanded_command_and_arguments-stderr.txt new file mode 100644 index 0000000..d640661 --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_expanded_command_and_arguments-stderr.txt @@ -0,0 +1 @@ +OK! diff --git a/Tests/RunCMake/cmake_language/eval_expanded_command_and_arguments.cmake b/Tests/RunCMake/cmake_language/eval_expanded_command_and_arguments.cmake new file mode 100644 index 0000000..f7d2d51 --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_expanded_command_and_arguments.cmake @@ -0,0 +1,2 @@ +set(cmd EVAL CODE [[message("OK!")]]) +cmake_language(${cmd}) diff --git a/Tests/RunCMake/cmake_language/eval_extra_parameters_between_eval_and_code-result.txt b/Tests/RunCMake/cmake_language/eval_extra_parameters_between_eval_and_code-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_extra_parameters_between_eval_and_code-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/eval_extra_parameters_between_eval_and_code-stderr.txt b/Tests/RunCMake/cmake_language/eval_extra_parameters_between_eval_and_code-stderr.txt new file mode 100644 index 0000000..d32054f --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_extra_parameters_between_eval_and_code-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at eval_extra_parameters_between_eval_and_code.cmake:1 \(cmake_language\): + cmake_language called with unsupported arguments between EVAL and CODE + arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/cmake_language/eval_extra_parameters_between_eval_and_code.cmake b/Tests/RunCMake/cmake_language/eval_extra_parameters_between_eval_and_code.cmake new file mode 100644 index 0000000..7c004d7 --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_extra_parameters_between_eval_and_code.cmake @@ -0,0 +1 @@ +cmake_language(EVAL BAD CODE "message(BAD CODE)") diff --git a/Tests/RunCMake/cmake_language/eval_message-stderr.txt b/Tests/RunCMake/cmake_language/eval_message-stderr.txt new file mode 100644 index 0000000..cfc8694 --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_message-stderr.txt @@ -0,0 +1 @@ +WORKS! diff --git a/Tests/RunCMake/cmake_language/eval_message.cmake b/Tests/RunCMake/cmake_language/eval_message.cmake new file mode 100644 index 0000000..91edcdd --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_message.cmake @@ -0,0 +1 @@ +cmake_language(EVAL CODE message(WORKS!)) diff --git a/Tests/RunCMake/cmake_language/eval_message_fatal_error-result.txt b/Tests/RunCMake/cmake_language/eval_message_fatal_error-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_message_fatal_error-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/eval_message_fatal_error-stderr.txt b/Tests/RunCMake/cmake_language/eval_message_fatal_error-stderr.txt new file mode 100644 index 0000000..5cf11e3 --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_message_fatal_error-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at eval_message_fatal_error.cmake:1:EVAL:2 \(message\): + error! +Call Stack \(most recent call first\): + eval_message_fatal_error.cmake:1 \(cmake_language\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/cmake_language/eval_message_fatal_error.cmake b/Tests/RunCMake/cmake_language/eval_message_fatal_error.cmake new file mode 100644 index 0000000..72e155d --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_message_fatal_error.cmake @@ -0,0 +1,5 @@ +cmake_language(EVAL CODE +" + message(FATAL_ERROR error!) +" +) diff --git a/Tests/RunCMake/cmake_language/eval_no_code-result.txt b/Tests/RunCMake/cmake_language/eval_no_code-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_no_code-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/eval_no_code-stderr.txt b/Tests/RunCMake/cmake_language/eval_no_code-stderr.txt new file mode 100644 index 0000000..608ba88 --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_no_code-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at eval_no_code.cmake:1 \(cmake_language\): + cmake_language called without CODE argument diff --git a/Tests/RunCMake/cmake_language/eval_no_code.cmake b/Tests/RunCMake/cmake_language/eval_no_code.cmake new file mode 100644 index 0000000..7f5bc21 --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_no_code.cmake @@ -0,0 +1 @@ +cmake_language(EVAL message "too many parameters") diff --git a/Tests/RunCMake/cmake_language/eval_no_parameters-result.txt b/Tests/RunCMake/cmake_language/eval_no_parameters-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_no_parameters-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/eval_no_parameters-stderr.txt b/Tests/RunCMake/cmake_language/eval_no_parameters-stderr.txt new file mode 100644 index 0000000..6166898 --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_no_parameters-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at eval_no_parameters.cmake:1 \(cmake_language\): + cmake_language called with incorrect number of arguments diff --git a/Tests/RunCMake/cmake_language/eval_no_parameters.cmake b/Tests/RunCMake/cmake_language/eval_no_parameters.cmake new file mode 100644 index 0000000..e7ae808 --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_no_parameters.cmake @@ -0,0 +1 @@ +cmake_language(EVAL) diff --git a/Tests/RunCMake/cmake_language/eval_variable_outside_message-stderr.txt b/Tests/RunCMake/cmake_language/eval_variable_outside_message-stderr.txt new file mode 100644 index 0000000..cfc8694 --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_variable_outside_message-stderr.txt @@ -0,0 +1 @@ +WORKS! diff --git a/Tests/RunCMake/cmake_language/eval_variable_outside_message.cmake b/Tests/RunCMake/cmake_language/eval_variable_outside_message.cmake new file mode 100644 index 0000000..71f0457 --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_variable_outside_message.cmake @@ -0,0 +1,2 @@ +cmake_language(EVAL CODE "set(phrase \"WORKS!\")") +message(${phrase}) diff --git a/Tests/RunCMake/cmake_language/no_parameters-result.txt b/Tests/RunCMake/cmake_language/no_parameters-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/no_parameters-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/no_parameters-stderr.txt b/Tests/RunCMake/cmake_language/no_parameters-stderr.txt new file mode 100644 index 0000000..194bbe3 --- /dev/null +++ b/Tests/RunCMake/cmake_language/no_parameters-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at no_parameters.cmake:1 \(cmake_language\): + cmake_language called with incorrect number of arguments diff --git a/Tests/RunCMake/cmake_language/no_parameters.cmake b/Tests/RunCMake/cmake_language/no_parameters.cmake new file mode 100644 index 0000000..8353e08 --- /dev/null +++ b/Tests/RunCMake/cmake_language/no_parameters.cmake @@ -0,0 +1 @@ +cmake_language(CALL) diff --git a/Tests/RunCMake/cmake_language/unknown_meta_operation-result.txt b/Tests/RunCMake/cmake_language/unknown_meta_operation-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/unknown_meta_operation-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/unknown_meta_operation-stderr.txt b/Tests/RunCMake/cmake_language/unknown_meta_operation-stderr.txt new file mode 100644 index 0000000..6a1d4fd --- /dev/null +++ b/Tests/RunCMake/cmake_language/unknown_meta_operation-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at unknown_meta_operation.cmake:1 \(cmake_language\): + cmake_language called with unknown meta-operation diff --git a/Tests/RunCMake/cmake_language/unknown_meta_operation.cmake b/Tests/RunCMake/cmake_language/unknown_meta_operation.cmake new file mode 100644 index 0000000..699f36f --- /dev/null +++ b/Tests/RunCMake/cmake_language/unknown_meta_operation.cmake @@ -0,0 +1 @@ +cmake_language(UNKNOWN) |