diff options
Diffstat (limited to 'Tests')
17 files changed, 73 insertions, 28 deletions
diff --git a/Tests/CMakeGUI/CMakeGUITest.cxx b/Tests/CMakeGUI/CMakeGUITest.cxx index 5a6bec3..2b5d973 100644 --- a/Tests/CMakeGUI/CMakeGUITest.cxx +++ b/Tests/CMakeGUI/CMakeGUITest.cxx @@ -356,16 +356,14 @@ void CMakeGUITest::changingPresets() QCOMPARE(this->m_window->Preset->presetName(), QString{}); QCOMPARE(this->m_window->Preset->presets().size(), 0); QCOMPARE(this->m_window->BinaryDirectory->currentText(), ""); - QCOMPARE(this->m_window->Preset->isHidden(), true); - QCOMPARE(this->m_window->PresetLabel->isHidden(), true); + QCOMPARE(this->m_window->Preset->isEnabled(), false); writePresets("build1", { "preset" }); loopSleep(1500); QCOMPARE(this->m_window->Preset->presetName(), QString{}); QCOMPARE(this->m_window->Preset->presets().size(), 1); QCOMPARE(this->m_window->BinaryDirectory->currentText(), ""); - QCOMPARE(this->m_window->Preset->isHidden(), false); - QCOMPARE(this->m_window->PresetLabel->isHidden(), false); + QCOMPARE(this->m_window->Preset->isEnabled(), true); this->m_window->Preset->setPresetName("preset"); loopSleep(); @@ -373,8 +371,7 @@ void CMakeGUITest::changingPresets() QCOMPARE(this->m_window->Preset->presets().size(), 1); QCOMPARE(this->m_window->BinaryDirectory->currentText(), CMakeGUITest_BINARY_DIR "/changingPresets/src/build1/preset"); - QCOMPARE(this->m_window->Preset->isHidden(), false); - QCOMPARE(this->m_window->PresetLabel->isHidden(), false); + QCOMPARE(this->m_window->Preset->isEnabled(), true); writePresets("build2", { "preset2", "preset" }); loopSleep(1500); @@ -382,8 +379,7 @@ void CMakeGUITest::changingPresets() QCOMPARE(this->m_window->Preset->presets().size(), 2); QCOMPARE(this->m_window->BinaryDirectory->currentText(), CMakeGUITest_BINARY_DIR "/changingPresets/src/build1/preset"); - QCOMPARE(this->m_window->Preset->isHidden(), false); - QCOMPARE(this->m_window->PresetLabel->isHidden(), false); + QCOMPARE(this->m_window->Preset->isEnabled(), true); writePresets("build3", { "preset2" }); loopSleep(1500); @@ -391,8 +387,7 @@ void CMakeGUITest::changingPresets() QCOMPARE(this->m_window->Preset->presets().size(), 1); QCOMPARE(this->m_window->BinaryDirectory->currentText(), CMakeGUITest_BINARY_DIR "/changingPresets/src/build1/preset"); - QCOMPARE(this->m_window->Preset->isHidden(), false); - QCOMPARE(this->m_window->PresetLabel->isHidden(), false); + QCOMPARE(this->m_window->Preset->isEnabled(), true); this->m_window->Preset->setPresetName("preset2"); loopSleep(); @@ -400,8 +395,7 @@ void CMakeGUITest::changingPresets() QCOMPARE(this->m_window->Preset->presets().size(), 1); QCOMPARE(this->m_window->BinaryDirectory->currentText(), CMakeGUITest_BINARY_DIR "/changingPresets/src/build3/preset2"); - QCOMPARE(this->m_window->Preset->isHidden(), false); - QCOMPARE(this->m_window->PresetLabel->isHidden(), false); + QCOMPARE(this->m_window->Preset->isEnabled(), true); QDir::root().mkpath(CMakeGUITest_BINARY_DIR "/changingPresets/src2"); QFile::copy(CMakeGUITest_BINARY_DIR "/changingPresets/src/CMakePresets.json", @@ -414,8 +408,7 @@ void CMakeGUITest::changingPresets() QCOMPARE(this->m_window->Preset->presets().size(), 1); QCOMPARE(this->m_window->BinaryDirectory->currentText(), CMakeGUITest_BINARY_DIR "/changingPresets/src/build3/preset2"); - QCOMPARE(this->m_window->Preset->isHidden(), false); - QCOMPARE(this->m_window->PresetLabel->isHidden(), false); + QCOMPARE(this->m_window->Preset->isEnabled(), true); this->m_window->Preset->setPresetName("preset2"); loopSleep(); @@ -423,8 +416,7 @@ void CMakeGUITest::changingPresets() QCOMPARE(this->m_window->Preset->presets().size(), 1); QCOMPARE(this->m_window->BinaryDirectory->currentText(), CMakeGUITest_BINARY_DIR "/changingPresets/src2/build3/preset2"); - QCOMPARE(this->m_window->Preset->isHidden(), false); - QCOMPARE(this->m_window->PresetLabel->isHidden(), false); + QCOMPARE(this->m_window->Preset->isEnabled(), true); QFile(CMakeGUITest_BINARY_DIR "/changingPresets/src2/CMakePresets.json") .remove(); @@ -433,8 +425,7 @@ void CMakeGUITest::changingPresets() QCOMPARE(this->m_window->Preset->presets().size(), 0); QCOMPARE(this->m_window->BinaryDirectory->currentText(), CMakeGUITest_BINARY_DIR "/changingPresets/src2/build3/preset2"); - QCOMPARE(this->m_window->Preset->isHidden(), true); - QCOMPARE(this->m_window->PresetLabel->isHidden(), true); + QCOMPARE(this->m_window->Preset->isEnabled(), false); } void SetupDefaultQSettings() diff --git a/Tests/RunCMake/CTest/RunCMakeTest.cmake b/Tests/RunCMake/CTest/RunCMakeTest.cmake index 62606f8..ffc8f78 100644 --- a/Tests/RunCMake/CTest/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTest/RunCMakeTest.cmake @@ -27,3 +27,14 @@ function(run_TestfileErrors) run_cmake_command(TestfileErrors-test ${CMAKE_CTEST_COMMAND} -C Debug) endfunction() run_TestfileErrors() + +function(run_SingleConfig) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/SingleConfig-build) + run_cmake(SingleConfig) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(SingleConfig-build ${CMAKE_COMMAND} --build .) + run_cmake_command(SingleConfig-test ${CMAKE_CTEST_COMMAND}) # No -C Debug required for single-config. +endfunction() +if(NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) + run_SingleConfig() +endif() diff --git a/Tests/RunCMake/CTest/SingleConfig-test-stdout.txt b/Tests/RunCMake/CTest/SingleConfig-test-stdout.txt new file mode 100644 index 0000000..1c39ea1 --- /dev/null +++ b/Tests/RunCMake/CTest/SingleConfig-test-stdout.txt @@ -0,0 +1,8 @@ +^Test project [^ +]*/Tests/RunCMake/CTest/SingleConfig-build + Start 1: SingleConfig +1/1 Test #1: SingleConfig \.+ +Passed +[0-9.]+ sec ++ +100% tests passed, 0 tests failed out of 1 ++ +Total Test time \(real\) = +[0-9.]+ sec$ diff --git a/Tests/RunCMake/CTest/SingleConfig.cmake b/Tests/RunCMake/CTest/SingleConfig.cmake new file mode 100644 index 0000000..7c10e06 --- /dev/null +++ b/Tests/RunCMake/CTest/SingleConfig.cmake @@ -0,0 +1,6 @@ +include(CTest) + +# This should be ignored by single-config generators. +set(CMAKE_CONFIGURATION_TYPES "Release;Debug" CACHE INTERNAL "Supported configuration types") + +add_test(NAME SingleConfig COMMAND ${CMAKE_COMMAND} -E echo SingleConfig) diff --git a/Tests/RunCMake/CheckSourceCompiles/RunCMakeTest.cmake b/Tests/RunCMake/CheckSourceCompiles/RunCMakeTest.cmake index 22cb466..6e9088f 100644 --- a/Tests/RunCMake/CheckSourceCompiles/RunCMakeTest.cmake +++ b/Tests/RunCMake/CheckSourceCompiles/RunCMakeTest.cmake @@ -2,6 +2,7 @@ include(RunCMake) run_cmake(NotEnabledLanguage) run_cmake(NonExistentLanguage) +run_cmake(UnknownArgument) run_cmake(CheckCSourceCompiles) run_cmake(CheckCXXSourceCompiles) diff --git a/Tests/RunCMake/File_Configure/BadArgGeneratorExpressionContent-result.txt b/Tests/RunCMake/CheckSourceCompiles/UnknownArgument-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/File_Configure/BadArgGeneratorExpressionContent-result.txt +++ b/Tests/RunCMake/CheckSourceCompiles/UnknownArgument-result.txt diff --git a/Tests/RunCMake/CheckSourceCompiles/UnknownArgument-stderr.txt b/Tests/RunCMake/CheckSourceCompiles/UnknownArgument-stderr.txt new file mode 100644 index 0000000..eed581a --- /dev/null +++ b/Tests/RunCMake/CheckSourceCompiles/UnknownArgument-stderr.txt @@ -0,0 +1,9 @@ +^CMake Error at [^ +]*/Modules/CheckSourceCompiles.cmake:[0-9]+ \(message\): + Unknown argument: + + BAD + +Call Stack \(most recent call first\): + UnknownArgument.cmake:[0-9]+ \(check_source_compiles\) + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/CheckSourceCompiles/UnknownArgument.cmake b/Tests/RunCMake/CheckSourceCompiles/UnknownArgument.cmake new file mode 100644 index 0000000..3b861da --- /dev/null +++ b/Tests/RunCMake/CheckSourceCompiles/UnknownArgument.cmake @@ -0,0 +1,5 @@ + +enable_language (C) +include(CheckSourceCompiles) + +check_source_compiles(C "int main() {return 0;}" SHOULD_BUILD SRC_EXT C BAD) diff --git a/Tests/RunCMake/CheckSourceRuns/RunCMakeTest.cmake b/Tests/RunCMake/CheckSourceRuns/RunCMakeTest.cmake index b27b08d..c99ac8b 100644 --- a/Tests/RunCMake/CheckSourceRuns/RunCMakeTest.cmake +++ b/Tests/RunCMake/CheckSourceRuns/RunCMakeTest.cmake @@ -2,6 +2,7 @@ include(RunCMake) run_cmake(NotEnabledLanguage) run_cmake(NonExistentLanguage) +run_cmake(UnknownArgument) run_cmake(CheckCSourceRuns) run_cmake(CheckCXXSourceRuns) diff --git a/Tests/RunCMake/CheckSourceRuns/UnknownArgument-result.txt b/Tests/RunCMake/CheckSourceRuns/UnknownArgument-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CheckSourceRuns/UnknownArgument-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CheckSourceRuns/UnknownArgument-stderr.txt b/Tests/RunCMake/CheckSourceRuns/UnknownArgument-stderr.txt new file mode 100644 index 0000000..8ae1ea1 --- /dev/null +++ b/Tests/RunCMake/CheckSourceRuns/UnknownArgument-stderr.txt @@ -0,0 +1,9 @@ +^CMake Error at [^ +]*/Modules/CheckSourceRuns.cmake:[0-9]+ \(message\): + Unknown argument: + + BAD + +Call Stack \(most recent call first\): + UnknownArgument.cmake:[0-9]+ \(check_source_runs\) + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/CheckSourceRuns/UnknownArgument.cmake b/Tests/RunCMake/CheckSourceRuns/UnknownArgument.cmake new file mode 100644 index 0000000..6e50fa7 --- /dev/null +++ b/Tests/RunCMake/CheckSourceRuns/UnknownArgument.cmake @@ -0,0 +1,5 @@ + +enable_language (C) +include(CheckSourceRuns) + +check_source_runs(C "int main() {return 0;}" SHOULD_BUILD SRC_EXT C BAD) diff --git a/Tests/RunCMake/File_Configure/AngleBracketsContent-stderr.txt b/Tests/RunCMake/File_Configure/AngleBracketsContent-stderr.txt new file mode 100644 index 0000000..08c2ada --- /dev/null +++ b/Tests/RunCMake/File_Configure/AngleBracketsContent-stderr.txt @@ -0,0 +1 @@ +^foo-\$<CONFIG>$ diff --git a/Tests/RunCMake/File_Configure/AngleBracketsContent.cmake b/Tests/RunCMake/File_Configure/AngleBracketsContent.cmake new file mode 100644 index 0000000..04c63bb --- /dev/null +++ b/Tests/RunCMake/File_Configure/AngleBracketsContent.cmake @@ -0,0 +1,6 @@ +file(CONFIGURE + OUTPUT "file.txt" + CONTENT "foo-$<CONFIG>" +) +file(READ ${CMAKE_CURRENT_BINARY_DIR}/file.txt out) +message("${out}") diff --git a/Tests/RunCMake/File_Configure/BadArgGeneratorExpressionContent-stderr.txt b/Tests/RunCMake/File_Configure/BadArgGeneratorExpressionContent-stderr.txt deleted file mode 100644 index acda654..0000000 --- a/Tests/RunCMake/File_Configure/BadArgGeneratorExpressionContent-stderr.txt +++ /dev/null @@ -1,5 +0,0 @@ -CMake Error at BadArgGeneratorExpressionContent.cmake:[0-9]+ \(file\): - file CONFIGURE called with CONTENT containing a "<". This character is not - allowed. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/File_Configure/BadArgGeneratorExpressionContent.cmake b/Tests/RunCMake/File_Configure/BadArgGeneratorExpressionContent.cmake deleted file mode 100644 index 75fe9e5..0000000 --- a/Tests/RunCMake/File_Configure/BadArgGeneratorExpressionContent.cmake +++ /dev/null @@ -1,4 +0,0 @@ -file(CONFIGURE - OUTPUT "file.txt" - CONTENT "foo-$<CONFIG>" -) diff --git a/Tests/RunCMake/File_Configure/RunCMakeTest.cmake b/Tests/RunCMake/File_Configure/RunCMakeTest.cmake index 0337014..e79de79 100644 --- a/Tests/RunCMake/File_Configure/RunCMakeTest.cmake +++ b/Tests/RunCMake/File_Configure/RunCMakeTest.cmake @@ -1,7 +1,7 @@ include(RunCMake) +run_cmake(AngleBracketsContent) run_cmake(BadArg) -run_cmake(BadArgGeneratorExpressionContent) run_cmake(BadArgGeneratorExpressionOutput) run_cmake(DirOutput) run_cmake(NewLineStyle-NoArg) |