| 407 | } |
| 408 | |
| 409 | static bool testCreateFromStackFrame() |
| 410 | { |
| 411 | auto variablesManager = |
| 412 | std::make_shared<cmDebugger::cmDebuggerVariablesManager>(); |
| 413 | auto dummies = CreateDummies("Foo"); |
| 414 | |
| 415 | cmListFileFunction lff = cmListFileFunction("set", 99, 99, {}); |
| 416 | auto frame = std::make_shared<cmDebugger::cmDebuggerStackFrame>( |
| 417 | dummies.Makefile.get(), "c:/CMakeLists.txt", lff); |
| 418 | |
| 419 | dummies.CMake->AddCacheEntry("CMAKE_BUILD_TYPE", "Debug", "Build Type", |
| 420 | cmStateEnums::CacheEntryType::STRING); |
| 421 | |
| 422 | auto locals = cmDebugger::cmDebuggerVariablesHelper::Create( |
| 423 | variablesManager, "Locals", true, frame); |
| 424 | |
| 425 | dap::array<dap::Variable> variables = |
| 426 | variablesManager->HandleVariablesRequest( |
| 427 | CreateVariablesRequest(locals->GetId())); |
| 428 | |
| 429 | ASSERT_TRUE(variables.size() == 5); |
| 430 | ASSERT_VARIABLE(variables[0], "CacheVariables", "1", "collection"); |
| 431 | ASSERT_VARIABLE(variables[1], "CurrentLine", std::to_string(lff.Line()), |
| 432 | "int"); |
| 433 | ASSERT_VARIABLE(variables[2], "Directories", "2", "collection"); |
| 434 | ASSERT_VARIABLE(variables[3], "Locals", "2", "collection"); |
| 435 | ASSERT_VARIABLE(variables[4], "Targets", "1", "collection"); |
| 436 | |
| 437 | dap::array<dap::Variable> cacheVariables = |
| 438 | variablesManager->HandleVariablesRequest( |
| 439 | CreateVariablesRequest(variables[0].variablesReference)); |
| 440 | ASSERT_TRUE(cacheVariables.size() == 1); |
| 441 | ASSERT_VARIABLE(cacheVariables[0], "CMAKE_BUILD_TYPE:STRING", "Debug", |
| 442 | "collection"); |
| 443 | |
| 444 | dap::array<dap::Variable> directoriesVariables = |
| 445 | variablesManager->HandleVariablesRequest( |
| 446 | CreateVariablesRequest(variables[2].variablesReference)); |
| 447 | ASSERT_TRUE(directoriesVariables.size() == 2); |
| 448 | ASSERT_VARIABLE( |
| 449 | directoriesVariables[0], "CMAKE_CURRENT_BINARY_DIR", |
| 450 | dummies.Makefile->GetStateSnapshot().GetDirectory().GetCurrentBinary(), |
| 451 | "string"); |
| 452 | ASSERT_VARIABLE( |
| 453 | directoriesVariables[1], "CMAKE_CURRENT_SOURCE_DIR", |
| 454 | dummies.Makefile->GetStateSnapshot().GetDirectory().GetCurrentSource(), |
| 455 | "string"); |
| 456 | |
| 457 | dap::array<dap::Variable> propertiesVariables = |
| 458 | variablesManager->HandleVariablesRequest( |
| 459 | CreateVariablesRequest(cacheVariables[0].variablesReference)); |
| 460 | ASSERT_TRUE(propertiesVariables.size() == 3); |
| 461 | ASSERT_VARIABLE(propertiesVariables[0], "HELPSTRING", "Build Type", |
| 462 | "string"); |
| 463 | ASSERT_VARIABLE(propertiesVariables[1], "TYPE", "STRING", "string"); |
| 464 | ASSERT_VARIABLE(propertiesVariables[2], "VALUE", "Debug", "string"); |
| 465 | |
| 466 | return true; |
nothing calls this directly
no test coverage detected
searching dependent graphs…