Add tests for unused command line variables

This commit is contained in:
Ben Boeckel 2010-09-02 11:33:57 -04:00
parent 300fc15779
commit 75bda3864e
2 changed files with 29 additions and 0 deletions

View File

@ -1074,6 +1074,34 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BundleGeneratorTest")
ENDIF(APPLE AND CTEST_TEST_CPACK)
ADD_TEST(WarnUnusedCliUnused ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMake_SOURCE_DIR}/Tests/VariableUsage"
"${CMake_BINARY_DIR}/Tests/WarnUnusedCliUnused"
--build-generator ${CMAKE_TEST_GENERATOR}
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
--build-noclean
--build-project WarnUnusedCliUnused
--build-options "-DUNUSED_VARIABLE=Unused")
SET_TESTS_PROPERTIES(WarnUnusedCliUnused PROPERTIES
PASS_REGULAR_EXPRESSION "warning: The variable, \"UNUSED_VARIABLE\"")
LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedCliUnused")
ADD_TEST(WarnUnusedCliUsed ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMake_SOURCE_DIR}/Tests/VariableUsage"
"${CMake_BINARY_DIR}/Tests/WarnUnusedCliUsed"
--build-generator ${CMAKE_TEST_GENERATOR}
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
--build-noclean
--build-project WarnUnusedCliUsed
--build-options "-DUSED_VARIABLE=Usage proven")
SET_TESTS_PROPERTIES(WarnUnusedCliUsed PROPERTIES
PASS_REGULAR_EXPRESSION "Usage proven")
SET_TESTS_PROPERTIES(WarnUnusedCliUsed PROPERTIES
FAIL_REGULAR_EXPRESSION "warning: The variable, \"USED_VARIABLE\"")
LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedCliUsed")
# Make sure CTest can handle a test with no newline in output.
ADD_TEST(CTest.NoNewline
${CMAKE_CMAKE_COMMAND} -E echo_append "This line has no newline!")

View File

@ -0,0 +1 @@
message(STATUS "${USED_VARIABLE}")