diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 30d8c53..0af4b2c 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -21,4 +21,5 @@ add_cmake_test( "Assert equal strings" "Assert unequal strings" "Mock message" + "Assert messages" ) diff --git a/test/cmake/AssertionTest.cmake b/test/cmake/AssertionTest.cmake index a574eb8..5f1e4d9 100644 --- a/test/cmake/AssertionTest.cmake +++ b/test/cmake/AssertionTest.cmake @@ -27,18 +27,17 @@ function(test_assert_unequal_strings) assert_not_strequal("some string" "some other string") endfunction() +function(call_sample_messages) + message(WARNING "some warning message") + message(WARNING "some other warning message") + message(ERROR "some error message") + message(FATAL_ERROR "some fatal error message") + message(ERROR "some other error message") +endfunction() + function(test_mock_message) mock_message(ON) - - function(test) - message(WARNING "some warning message") - message(WARNING "some other warning message") - message(ERROR "some error message") - message(FATAL_ERROR "some fatal error message") - message(ERROR "some other error message") - endfunction() - test() - + call_sample_messages() mock_message(OFF) assert_defined(WARNING_MESSAGES) @@ -51,6 +50,17 @@ function(test_mock_message) assert_strequal("${FATAL_ERROR_MESSAGES}" "some fatal error message") endfunction() +function(test_assert_messages) + mock_message(ON) + call_sample_messages() + mock_message(OFF) + + assert_message(WARNING "some warning message") + assert_message(WARNING "some other warning message") + assert_message(ERROR "some error message") + assert_message(FATAL_ERROR "some fatal error message") +endfunction() + if(NOT DEFINED TEST_COMMAND) message(FATAL_ERROR "The 'TEST_COMMAND' variable should be defined") elseif(NOT COMMAND test_${TEST_COMMAND})