testDebuggerThread.cxx 832 B

123456789101112131415161718192021222324252627282930313233
  1. #include <functional>
  2. #include <memory>
  3. #include <string>
  4. #include <vector>
  5. #include <cm3p/cppdap/protocol.h>
  6. #include <cm3p/cppdap/types.h>
  7. #include "cmDebuggerThread.h"
  8. #include "cmListFileCache.h"
  9. #include "testCommon.h"
  10. static bool testStackFrameFunctionName()
  11. {
  12. auto thread = std::make_shared<cmDebugger::cmDebuggerThread>(0, "name");
  13. const auto* functionName = "function_name";
  14. auto arguments = std::vector<cmListFileArgument>{};
  15. cmListFileFunction func(functionName, 10, 20, arguments);
  16. thread->PushStackFrame(nullptr, "CMakeLists.txt", func);
  17. auto stackTrace = GetStackTraceResponse(thread);
  18. ASSERT_TRUE(stackTrace.stackFrames[0].name == functionName);
  19. return true;
  20. }
  21. int testDebuggerThread(int, char*[])
  22. {
  23. return runTests(std::vector<std::function<bool()>>{
  24. testStackFrameFunctionName,
  25. });
  26. }