FPHSA: Convert FOUND_VAR failure test to RunCMake

Move the Tests/FPHSA_InvalidFOUND_VAR test case over to a new
RunCMake.FPHSA test with a BadFoundVar case.  The RunCMake tests are
built to cover failure cases easily and robustly.
This commit is contained in:
Brad King 2013-02-22 08:44:13 -05:00
parent c1f5780e2d
commit f17711c546
8 changed files with 15 additions and 5 deletions

View File

@ -147,9 +147,6 @@ if(BUILD_TESTING)
# add a bunch of standard build-and-test style tests
ADD_TEST_MACRO(CommandLineTest CommandLineTest)
ADD_TEST_MACRO(FindPackageTest FindPackageTest)
ADD_TEST_MACRO(FPHSA_InvalidFOUND_VAR FPHSA_InvalidFOUND_VAR)
set_tests_properties(FPHSA_InvalidFOUND_VAR PROPERTIES
PASS_REGULAR_EXPRESSION "The argument for FOUND_VAR is .badfoundvar_FOUND., but only")
ADD_TEST_MACRO(FindModulesExecuteAll FindModulesExecuteAll)
ADD_TEST_MACRO(StringFileTest StringFileTest)
ADD_TEST_MACRO(TryCompile TryCompile)

View File

@ -56,6 +56,7 @@ if(UNIX AND "${CMAKE_TEST_GENERATOR}" MATCHES "Unix Makefiles")
add_RunCMake_test(CompilerChange)
endif()
add_RunCMake_test(ExternalData)
add_RunCMake_test(FPHSA)
add_RunCMake_test(GeneratorExpression)
add_RunCMake_test(GeneratorToolset)
add_RunCMake_test(TargetPropertyGeneratorExpressions)

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,7 @@
CMake Error at .*/Modules/FindPackageHandleStandardArgs.cmake:[0-9]+ \(message\):
The argument for FOUND_VAR is "badfoundvar_FOUND", but only
"BadFoundVar_FOUND" and "BADFOUNDVAR_FOUND" are valid names.
Call Stack \(most recent call first\):
FindBadFoundVar.cmake:5 \(find_package_handle_standard_args\)
BadFoundVar.cmake:3 \(find_package\)
CMakeLists.txt:3 \(include\)

View File

@ -1,5 +1,3 @@
cmake_minimum_required(VERSION 2.8)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
find_package(BadFoundVar REQUIRED)

View File

@ -0,0 +1,3 @@
cmake_minimum_required(VERSION 2.8)
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake)

View File

@ -0,0 +1,3 @@
include(RunCMake)
run_cmake(BadFoundVar)