summaryrefslogtreecommitdiffstats
path: root/Tests/CMakeLib
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-07-13 12:36:22 (GMT)
committerKitware Robot <kwrobot@kitware.com>2023-07-13 12:36:25 (GMT)
commitdab61cf1aaea2ca9d668d62906aa17b39ae5ba23 (patch)
tree9218e47169e5ed27dab432ccfadfe4a2132ac03f /Tests/CMakeLib
parent78e9225a467c38a4b862853756cee6d1bd379f22 (diff)
parente02cf3f1906dda51e5cdf8ae38b3eb46176a90f1 (diff)
downloadCMake-dab61cf1aaea2ca9d668d62906aa17b39ae5ba23.zip
CMake-dab61cf1aaea2ca9d668d62906aa17b39ae5ba23.tar.gz
CMake-dab61cf1aaea2ca9d668d62906aa17b39ae5ba23.tar.bz2
Merge topic 'debugger-no-supportsVariableType'
e02cf3f190 Debugger: Correctly handle clients without supportsVariableType Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Acked-by: Garrett Campbell <gcampbell@microsoft.com> Merge-request: !8620
Diffstat (limited to 'Tests/CMakeLib')
-rw-r--r--Tests/CMakeLib/testDebugger.h12
-rw-r--r--Tests/CMakeLib/testDebuggerVariables.cxx29
-rw-r--r--Tests/CMakeLib/testDebuggerVariablesHelper.cxx1
3 files changed, 38 insertions, 4 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/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>