diff options
Diffstat (limited to 'Tests')
19 files changed, 80 insertions, 15 deletions
diff --git a/Tests/CMakeLib/testDebugger.h b/Tests/CMakeLib/testDebugger.h index 8ba21f6..d8d2caa 100644 --- a/Tests/CMakeLib/testDebugger.h +++ b/Tests/CMakeLib/testDebugger.h @@ -19,11 +19,15 @@ do { \ ASSERT_TRUE(x.name == expectedName); \ ASSERT_TRUE(x.value == expectedValue); \ - ASSERT_TRUE(x.type.value() == expectedType); \ - ASSERT_TRUE(x.evaluateName.has_value() == false); \ - if (std::string(expectedType) == "collection") { \ - ASSERT_TRUE(x.variablesReference != 0); \ + if (expectedType == nullptr) { \ + ASSERT_TRUE(x.type == dap::optional<dap::string>()); \ + } else { \ + ASSERT_TRUE(x.type == dap::optional<dap::string>(expectedType)); \ + if (std::string(expectedType) == "collection") { \ + ASSERT_TRUE(x.variablesReference != 0); \ + } \ } \ + ASSERT_TRUE(x.evaluateName.has_value() == false); \ } while (false) #define ASSERT_VARIABLE_REFERENCE(x, expectedName, expectedValue, \ diff --git a/Tests/CMakeLib/testDebuggerBreakpointManager.cxx b/Tests/CMakeLib/testDebuggerBreakpointManager.cxx index 83734ea..f654442 100644 --- a/Tests/CMakeLib/testDebuggerBreakpointManager.cxx +++ b/Tests/CMakeLib/testDebuggerBreakpointManager.cxx @@ -51,6 +51,13 @@ static bool testHandleBreakpointRequestBeforeFileIsLoaded() sourcePath, false); ASSERT_BREAKPOINT(response.breakpoints[2], 2, sourceBreakpoints[2].line, sourcePath, false); + ASSERT_TRUE(breakpointManager.GetBreakpointCount() == 3); + + // setBreakpoints should override any existing breakpoints + setBreakpointRequest.breakpoints.value().clear(); + helper.Client->send(setBreakpointRequest).get(); + ASSERT_TRUE(breakpointManager.GetBreakpointCount() == 0); + return true; } @@ -103,6 +110,12 @@ static bool testHandleBreakpointRequestAfterFileIsLoaded() sourcePath, true); ASSERT_TRUE(notExpectBreakpointEvents.load()); + ASSERT_TRUE(breakpointManager.GetBreakpointCount() == 5); + + // setBreakpoints should override any existing breakpoints + setBreakpointRequest.breakpoints.value().clear(); + helper.Client->send(setBreakpointRequest).get(); + ASSERT_TRUE(breakpointManager.GetBreakpointCount() == 0); return true; } diff --git a/Tests/CMakeLib/testDebuggerVariables.cxx b/Tests/CMakeLib/testDebuggerVariables.cxx index 6c19baa..0d8d18d 100644 --- a/Tests/CMakeLib/testDebuggerVariables.cxx +++ b/Tests/CMakeLib/testDebuggerVariables.cxx @@ -8,6 +8,7 @@ #include <unordered_set> #include <vector> +#include <cm3p/cppdap/optional.h> #include <cm3p/cppdap/protocol.h> #include <cm3p/cppdap/types.h> @@ -174,6 +175,33 @@ static bool testSortTheResult() return true; } +static bool testNoSupportsVariableType() +{ + auto variablesManager = + std::make_shared<cmDebugger::cmDebuggerVariablesManager>(); + + auto vars = std::make_shared<cmDebugger::cmDebuggerVariables>( + variablesManager, "Variables", false, []() { + return std::vector<cmDebugger::cmDebuggerVariableEntry>{ { "test", + "value" } }; + }); + + auto subvars = std::make_shared<cmDebugger::cmDebuggerVariables>( + variablesManager, "Children", false); + + vars->AddSubVariables(subvars); + + dap::array<dap::Variable> variables = + variablesManager->HandleVariablesRequest( + CreateVariablesRequest(vars->GetId())); + + ASSERT_TRUE(variables.size() == 2); + ASSERT_VARIABLE(variables[0], "Children", "", nullptr); + ASSERT_VARIABLE(variables[1], "test", "value", nullptr); + + return true; +} + int testDebuggerVariables(int, char*[]) { return runTests(std::vector<std::function<bool()>>{ @@ -181,5 +209,6 @@ int testDebuggerVariables(int, char*[]) testConstructors, testIgnoreEmptyStringEntries, testSortTheResult, + testNoSupportsVariableType, }); } diff --git a/Tests/CMakeLib/testDebuggerVariablesHelper.cxx b/Tests/CMakeLib/testDebuggerVariablesHelper.cxx index e0bbdf0..d61b73b 100644 --- a/Tests/CMakeLib/testDebuggerVariablesHelper.cxx +++ b/Tests/CMakeLib/testDebuggerVariablesHelper.cxx @@ -8,6 +8,7 @@ #include <utility> #include <vector> +#include <cm3p/cppdap/optional.h> #include <cm3p/cppdap/protocol.h> #include <cm3p/cppdap/types.h> #include <stddef.h> diff --git a/Tests/RunCMake/CXXModules/CMakeLists.txt b/Tests/RunCMake/CXXModules/CMakeLists.txt index 88eb282..640d67b 100644 --- a/Tests/RunCMake/CXXModules/CMakeLists.txt +++ b/Tests/RunCMake/CXXModules/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.23) project(${RunCMake_TEST} NONE) -set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "aa1f7df0-828a-4fcd-9afc-2dc80491aca7") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "bf70d4b0-9fb7-465c-9803-34014e70d112") include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CXXModules/examples/cxx-modules-rules.cmake b/Tests/RunCMake/CXXModules/examples/cxx-modules-rules.cmake index ff7219a..c17b5a4 100644 --- a/Tests/RunCMake/CXXModules/examples/cxx-modules-rules.cmake +++ b/Tests/RunCMake/CXXModules/examples/cxx-modules-rules.cmake @@ -1,4 +1,4 @@ -set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "aa1f7df0-828a-4fcd-9afc-2dc80491aca7") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "bf70d4b0-9fb7-465c-9803-34014e70d112") if (NOT EXISTS "${CMake_TEST_MODULE_COMPILATION_RULES}") message(FATAL_ERROR diff --git a/Tests/RunCMake/CXXModules/examples/deep-chain-stderr.txt b/Tests/RunCMake/CXXModules/examples/deep-chain-stderr.txt index 78bdf2b..659414d 100644 --- a/Tests/RunCMake/CXXModules/examples/deep-chain-stderr.txt +++ b/Tests/RunCMake/CXXModules/examples/deep-chain-stderr.txt @@ -1,4 +1,4 @@ -CMake Warning \(dev\) at CMakeLists.txt:7 \(target_sources\): +CMake Warning \(dev\) at CMakeLists.txt:15 \(target_sources\): CMake's C\+\+ module support is experimental. It is meant only for experimentation and feedback to CMake developers. This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/examples/deep-chain/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/deep-chain/CMakeLists.txt index 515b240..78a1d0b 100644 --- a/Tests/RunCMake/CXXModules/examples/deep-chain/CMakeLists.txt +++ b/Tests/RunCMake/CXXModules/examples/deep-chain/CMakeLists.txt @@ -3,6 +3,14 @@ project(cxx_modules_deep_chain CXX) include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake") +if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + include(CheckCompilerFlag) + check_compiler_flag(CXX "-Wread-modules-implicitly" have_implicit_module_warning) + if (have_implicit_module_warning) + add_compile_options(-Werror=read-modules-implicitly) + endif () +endif () + add_library(a STATIC) target_sources(a PUBLIC diff --git a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/test/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/test/CMakeLists.txt index d227e55..a3e55f6 100644 --- a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/test/CMakeLists.txt +++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/test/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.24) project(cxx_modules_library NONE) -set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "aa1f7df0-828a-4fcd-9afc-2dc80491aca7") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "bf70d4b0-9fb7-465c-9803-34014e70d112") find_package(export_bmi_and_interfaces REQUIRED) diff --git a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/test/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/test/CMakeLists.txt index d46d28b..0144b70 100644 --- a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/test/CMakeLists.txt +++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/test/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.24) project(cxx_modules_library NONE) -set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "aa1f7df0-828a-4fcd-9afc-2dc80491aca7") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "bf70d4b0-9fb7-465c-9803-34014e70d112") find_package(export_bmi_and_interfaces REQUIRED) diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-build/test/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-interface-build/test/CMakeLists.txt index 3cd156a..bd2f2d4 100644 --- a/Tests/RunCMake/CXXModules/examples/export-interface-build/test/CMakeLists.txt +++ b/Tests/RunCMake/CXXModules/examples/export-interface-build/test/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.24) project(cxx_modules_library NONE) -set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "aa1f7df0-828a-4fcd-9afc-2dc80491aca7") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "bf70d4b0-9fb7-465c-9803-34014e70d112") find_package(export_interfaces REQUIRED) diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-install/test/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-interface-install/test/CMakeLists.txt index 71bf86c..87451fe 100644 --- a/Tests/RunCMake/CXXModules/examples/export-interface-install/test/CMakeLists.txt +++ b/Tests/RunCMake/CXXModules/examples/export-interface-install/test/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.24) project(cxx_modules_library NONE) -set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "aa1f7df0-828a-4fcd-9afc-2dc80491aca7") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "bf70d4b0-9fb7-465c-9803-34014e70d112") find_package(export_interfaces REQUIRED) diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build/test/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build/test/CMakeLists.txt index 0c094ac..5b6abc6 100644 --- a/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build/test/CMakeLists.txt +++ b/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build/test/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.24) project(cxx_modules_library NONE) -set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "aa1f7df0-828a-4fcd-9afc-2dc80491aca7") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "bf70d4b0-9fb7-465c-9803-34014e70d112") find_package(export_interfaces_no_properties REQUIRED) diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install/test/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install/test/CMakeLists.txt index 0c094ac..5b6abc6 100644 --- a/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install/test/CMakeLists.txt +++ b/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install/test/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.24) project(cxx_modules_library NONE) -set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "aa1f7df0-828a-4fcd-9afc-2dc80491aca7") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "bf70d4b0-9fb7-465c-9803-34014e70d112") find_package(export_interfaces_no_properties REQUIRED) diff --git a/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-empty-element-check.cmake b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-empty-element-check.cmake new file mode 100644 index 0000000..a996e53 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-empty-element-check.cmake @@ -0,0 +1,6 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/REMOVE_DUPLICATES-generated.txt" content) + +set(expected "1;;2;3") +if(NOT content STREQUAL expected) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-empty-element.cmake b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-empty-element.cmake new file mode 100644 index 0000000..9d5944f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-empty-element.cmake @@ -0,0 +1,3 @@ +cmake_policy(VERSION 3.11) + +file(GENERATE OUTPUT "REMOVE_DUPLICATES-generated.txt" CONTENT "$<REMOVE_DUPLICATES:1$<SEMICOLON>$<SEMICOLON>2$<SEMICOLON>$<SEMICOLON>3>") diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index 3fd9947..2a0c893 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -36,6 +36,7 @@ run_cmake(TARGET_NAME_IF_EXISTS-alias-target) run_cmake(TARGET_NAME_IF_EXISTS-imported-target) run_cmake(TARGET_NAME_IF_EXISTS-imported-global-target) run_cmake(REMOVE_DUPLICATES-empty) +run_cmake(REMOVE_DUPLICATES-empty-element) run_cmake(REMOVE_DUPLICATES-1) run_cmake(REMOVE_DUPLICATES-2) run_cmake(REMOVE_DUPLICATES-3) diff --git a/Tests/RunCMake/target_sources/FileSetDefaultWrongTypeExperimental.cmake b/Tests/RunCMake/target_sources/FileSetDefaultWrongTypeExperimental.cmake index 44f1626..84e1802 100644 --- a/Tests/RunCMake/target_sources/FileSetDefaultWrongTypeExperimental.cmake +++ b/Tests/RunCMake/target_sources/FileSetDefaultWrongTypeExperimental.cmake @@ -1,6 +1,6 @@ enable_language(C) -set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "aa1f7df0-828a-4fcd-9afc-2dc80491aca7") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "bf70d4b0-9fb7-465c-9803-34014e70d112") add_library(lib1 STATIC empty.c) target_sources(lib1 PRIVATE FILE_SET UNKNOWN) diff --git a/Tests/RunCMake/target_sources/FileSetWrongTypeExperimental.cmake b/Tests/RunCMake/target_sources/FileSetWrongTypeExperimental.cmake index adf1185..78e782d 100644 --- a/Tests/RunCMake/target_sources/FileSetWrongTypeExperimental.cmake +++ b/Tests/RunCMake/target_sources/FileSetWrongTypeExperimental.cmake @@ -1,6 +1,6 @@ enable_language(C) -set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "aa1f7df0-828a-4fcd-9afc-2dc80491aca7") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "bf70d4b0-9fb7-465c-9803-34014e70d112") add_library(lib1 STATIC empty.c) target_sources(lib1 PRIVATE FILE_SET a TYPE UNKNOWN) |