From 91c4c9921c40361df860c1384a46ed77c6118c23 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 16 Sep 2010 13:54:16 -0400 Subject: [PATCH] Add test for unused warnings at the end of scope --- Tests/CMakeLists.txt | 15 +++++++++++++++ Tests/VariableUnusedViaScope/CMakeLists.txt | 2 ++ 2 files changed, 17 insertions(+) create mode 100644 Tests/VariableUnusedViaScope/CMakeLists.txt diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 739dcdf45..adc4f907f 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1104,6 +1104,21 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ FAIL_REGULAR_EXPRESSION ":5: warning: \\(unsetting\\) unused variable 'UNUSED_VARIABLE'") LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedUnusedViaUnset") + ADD_TEST(WarnUnusedUnusedViaScope ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/VariableUnusedViaScope" + "${CMake_BINARY_DIR}/Tests/WarnUnusedUnusedViaScope" + --build-generator ${CMAKE_TEST_GENERATOR} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + --build-noclean + --build-project WarnUnusedUnusedViaScope + --build-options "--warn-unused-vars") + SET_TESTS_PROPERTIES(WarnUnusedUnusedViaScope PROPERTIES + PASS_REGULAR_EXPRESSION "warning: \\(out of scope\\) unused variable 'UNUSED_VARIABLE'") + SET_TESTS_PROPERTIES(WarnUnusedUnusedViaScope PROPERTIES + FAIL_REGULAR_EXPRESSION "warning: \\(unsetting\\) unused variable 'UNUSED_VARIABLE'") + LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedUnusedViaScope") + ADD_TEST(WarnUnusedCliUnused ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/VariableUsage" diff --git a/Tests/VariableUnusedViaScope/CMakeLists.txt b/Tests/VariableUnusedViaScope/CMakeLists.txt new file mode 100644 index 000000000..a024bc5a7 --- /dev/null +++ b/Tests/VariableUnusedViaScope/CMakeLists.txt @@ -0,0 +1,2 @@ +set(UNUSED_VARIABLE) +# Warning should occur here