summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOrkun Tokdemir <ilhanorkuntokdemir@gmail.com>2023-09-26 15:08:20 (GMT)
committerBrad King <brad.king@kitware.com>2023-09-26 15:54:09 (GMT)
commit9654835b4f3c0e7b5fe41405f12c762875b54c6b (patch)
tree8020bf691d0554af8793fe454053a40ab61ac0ea
parent5a79ea2799e27dc78d71ad71cbf7009416e98076 (diff)
downloadCMake-9654835b4f3c0e7b5fe41405f12c762875b54c6b.zip
CMake-9654835b4f3c0e7b5fe41405f12c762875b54c6b.tar.gz
CMake-9654835b4f3c0e7b5fe41405f12c762875b54c6b.tar.bz2
Tests/RunCMake/Autogen: Add expect_n_times() function
-rw-r--r--Tests/RunCMake/Autogen/RunCMakeTest.cmake10
1 files changed, 10 insertions, 0 deletions
diff --git a/Tests/RunCMake/Autogen/RunCMakeTest.cmake b/Tests/RunCMake/Autogen/RunCMakeTest.cmake
index 12a8f8e..5c2ea2b 100644
--- a/Tests/RunCMake/Autogen/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Autogen/RunCMakeTest.cmake
@@ -239,6 +239,16 @@ ${make_program_stderr}
endif()
endfunction()
+ function(expect_n_times string_to_check expected_output expected_count test_name)
+ count_substring("${string_to_check}" "${expected_output}" count)
+ if(NOT count EQUAL ${expected_count})
+ message(STATUS "${test_name}-expect_${expected_count}_times - FAILED")
+ message(FATAL_ERROR "Expected to find ${expected_output} exactly ${expected_count} times in ${string_to_check} but found ${count} occurrences of ${expected_output}")
+ else()
+ message(STATUS "${test_name}-expect_${expected_count}_times - PASSED")
+ endif()
+ endfunction()
+
function(not_expect make_program_stdout unexpected_output test_name)
count_substring("${make_program_stdout}" "${unexpected_output}" count)
if(NOT count EQUAL 0)