diff options
author | Brad King <brad.king@kitware.com> | 2023-06-12 10:41:26 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2023-06-12 10:41:41 (GMT) |
commit | eec017cf8bc4fedcb8644026f3ddb3a1b1a58d83 (patch) | |
tree | 67315baa53f3190c249aca9829c660185fb414e2 /Tests | |
parent | 6bbbd01f7524ab04bea1486a043f313b1a0cf38c (diff) | |
parent | 1df3287bf6a49d410b81be670218259afc3474d4 (diff) | |
download | CMake-eec017cf8bc4fedcb8644026f3ddb3a1b1a58d83.zip CMake-eec017cf8bc4fedcb8644026f3ddb3a1b1a58d83.tar.gz CMake-eec017cf8bc4fedcb8644026f3ddb3a1b1a58d83.tar.bz2 |
Merge topic 'add_test-empty-args'
1df3287bf6 add_test: Restore support for empty test arguments
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8551
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/RunCMake/add_test/CheckEmptyArgument.cmake | 11 | ||||
-rw-r--r-- | Tests/RunCMake/add_test/EmptyArgument.cmake | 5 | ||||
-rw-r--r-- | Tests/RunCMake/add_test/RunCMakeTest.cmake | 8 |
3 files changed, 24 insertions, 0 deletions
diff --git a/Tests/RunCMake/add_test/CheckEmptyArgument.cmake b/Tests/RunCMake/add_test/CheckEmptyArgument.cmake new file mode 100644 index 0000000..9bf7976 --- /dev/null +++ b/Tests/RunCMake/add_test/CheckEmptyArgument.cmake @@ -0,0 +1,11 @@ +if (NOT CMAKE_ARGV4 STREQUAL "A") + message(FATAL_ERROR "wrong parsing of arguments") +endif() + +if (NOT CMAKE_ARGV5 STREQUAL "") + message(FATAL_ERROR "Empty argument was dropped") +endif() + +if (NOT CMAKE_ARGV6 STREQUAL "B") + message(FATAL_ERROR "wrong parsing of arguments") +endif() diff --git a/Tests/RunCMake/add_test/EmptyArgument.cmake b/Tests/RunCMake/add_test/EmptyArgument.cmake new file mode 100644 index 0000000..7d1a740 --- /dev/null +++ b/Tests/RunCMake/add_test/EmptyArgument.cmake @@ -0,0 +1,5 @@ +enable_testing() +add_test( + NAME "EmptyArgument" + COMMAND "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_LIST_DIR}/CheckEmptyArgument.cmake" -- "A" "" "B" +) diff --git a/Tests/RunCMake/add_test/RunCMakeTest.cmake b/Tests/RunCMake/add_test/RunCMakeTest.cmake index bf6cbff..ec6f6dd 100644 --- a/Tests/RunCMake/add_test/RunCMakeTest.cmake +++ b/Tests/RunCMake/add_test/RunCMakeTest.cmake @@ -33,3 +33,11 @@ foreach(case IN LISTS cases) run_case(OLD-${case}) run_case(NEW-${case}) endforeach() + +block() + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/EmptyArgument-build) + run_cmake(EmptyArgument) + # Run ctest on the generated CTestTestfile.cmake. + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(EmptyArgument-ctest ${CMAKE_CTEST_COMMAND} -C Debug) +endblock() |