FeatureSummary: Add unit tests

This commit is contained in:
Daniele E. Domenichelli 2014-03-03 19:51:57 +01:00
parent d348cd1bc5
commit 8372b4553b
18 changed files with 102 additions and 0 deletions

View File

@ -42,6 +42,7 @@ add_RunCMake_test(CompilerNotFound)
add_RunCMake_test(Configure)
add_RunCMake_test(DisallowedCommands)
add_RunCMake_test(ExternalData)
add_RunCMake_test(FeatureSummary)
add_RunCMake_test(FPHSA)
add_RunCMake_test(GeneratorExpression)
add_RunCMake_test(GeneratorToolset)

View File

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

View File

@ -0,0 +1,7 @@
-- The following features have been enabled:
\* Foo , Foo\.
-- The following features have been disabled:
\* Bar , Bar\.

View File

@ -0,0 +1,9 @@
include(FeatureSummary)
set(WITH_FOO 1)
set(WITH_BAR 0)
add_feature_info(Foo WITH_FOO "Foo.")
add_feature_info(Bar WITH_BAR "Bar.")
feature_summary(WHAT ALL)

View File

@ -0,0 +1,7 @@
-- The following features have been disabled:
\* Bar , Bar\.
-- The following features have been enabled:
\* Foo , Foo\.

View File

@ -0,0 +1,9 @@
include(FeatureSummary)
set(WITH_FOO 1)
set(WITH_BAR 0)
add_feature_info(Foo WITH_FOO "Foo.")
add_feature_info(Bar WITH_BAR "Bar.")
feature_summary(WHAT DISABLED_FEATURES ENABLED_FEATURES)

View File

@ -0,0 +1,6 @@
CMake Error at .*/Modules/FeatureSummary\.cmake:[0-9]+. \(message\):
The WHAT argument of FEATURE_SUMMARY\(\) contains ALL, which cannot be
combined with other values\.
Call Stack \(most recent call first\):
FeatureSummaryWhatListAll\.cmake:[0-9]+ \(feature_summary\)
CMakeLists.txt:[0-9]+ \(include\)

View File

@ -0,0 +1,9 @@
include(FeatureSummary)
set(WITH_FOO 1)
set(WITH_BAR 0)
add_feature_info(Foo WITH_FOO "Foo.")
add_feature_info(Bar WITH_BAR "Bar.")
feature_summary(WHAT ENABLED_FEATURES ALL)

View File

@ -0,0 +1,6 @@
CMake Error at .*/Modules/FeatureSummary\.cmake:[0-9]+. \(message\):
The WHAT argument of FEATURE_SUMMARY\(\) contains FOO, which is not a valid
value\.
Call Stack \(most recent call first\):
FeatureSummaryWhatListUnknown\.cmake:[0-9]+ \(feature_summary\)
CMakeLists.txt:[0-9]+ \(include\)

View File

@ -0,0 +1,9 @@
include(FeatureSummary)
set(WITH_FOO 1)
set(WITH_BAR 0)
add_feature_info(Foo WITH_FOO "Foo.")
add_feature_info(Bar WITH_BAR "Bar.")
feature_summary(WHAT ENABLED_FEATURES FOO)

View File

@ -0,0 +1 @@
\* Foo , Foo\.

View File

@ -0,0 +1,9 @@
include(FeatureSummary)
set(WITH_FOO 1)
set(WITH_BAR 0)
add_feature_info(Foo WITH_FOO "Foo.")
add_feature_info(Bar WITH_BAR "Bar.")
feature_summary(WHAT ENABLED_FEATURES)

View File

@ -0,0 +1,6 @@
CMake Error at .*/Modules/FeatureSummary\.cmake:[0-9]+. \(message\):
The WHAT argument of FEATURE_SUMMARY\(\) contains FOO, which is not a valid
value\.
Call Stack \(most recent call first\):
FeatureSummaryWhatSingleUnknown\.cmake:[0-9]+ \(feature_summary\)
CMakeLists.txt:[0-9]+ \(include\)

View File

@ -0,0 +1,9 @@
include(FeatureSummary)
set(WITH_FOO 1)
set(WITH_BAR 0)
add_feature_info(Foo WITH_FOO "Foo.")
add_feature_info(Bar WITH_BAR "Bar.")
feature_summary(WHAT FOO)

View File

@ -0,0 +1,8 @@
include(RunCMake)
run_cmake(FeatureSummaryWhatAll)
run_cmake(FeatureSummaryWhatSingle)
run_cmake(FeatureSummaryWhatSingleUnknown)
run_cmake(FeatureSummaryWhatList)
run_cmake(FeatureSummaryWhatListUnknown)
run_cmake(FeatureSummaryWhatListAll)