MCPcopy Create free account
hub / github.com/Kitware/CMake / testCreateFromMakefile

Function testCreateFromMakefile

Tests/CMakeLib/testDebuggerVariablesHelper.cxx:365–407  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

363}
364
365static bool testCreateFromMakefile()
366{
367 auto variablesManager =
368 std::make_shared<cmDebugger::cmDebuggerVariablesManager>();
369
370 auto dummies = CreateDummies("Foo");
371 auto snapshot = dummies.Makefile->GetStateSnapshot();
372 auto state = dummies.Makefile->GetState();
373 state->SetSourceDirectory("c:/HomeDirectory");
374 state->SetBinaryDirectory("c:/HomeOutputDirectory");
375 auto vars = cmDebugger::cmDebuggerVariablesHelper::CreateIfAny(
376 variablesManager, "Locals", true, dummies.Makefile.get());
377
378 dap::array<dap::Variable> variables =
379 variablesManager->HandleVariablesRequest(
380 CreateVariablesRequest(vars->GetId()));
381
382 ASSERT_TRUE(variables.size() == 12);
383 ASSERT_VARIABLE(variables[0], "AppleSDKType", "MacOS", "string");
384 ASSERT_VARIABLE(variables[1], "CurrentBinaryDirectory",
385 snapshot.GetDirectory().GetCurrentBinary(), "string");
386 ASSERT_VARIABLE(variables[2], "CurrentSourceDirectory",
387 snapshot.GetDirectory().GetCurrentSource(), "string");
388 ASSERT_VARIABLE(variables[3], "DefineFlags", " ", "string");
389 ASSERT_VARIABLE(variables[4], "DirectoryId",
390 dummies.Makefile->GetDirectoryId().String, "string");
391 ASSERT_VARIABLE(variables[5], "HomeDirectory", state->GetSourceDirectory(),
392 "string");
393 ASSERT_VARIABLE(variables[6], "HomeOutputDirectory",
394 state->GetBinaryDirectory(), "string");
395 ASSERT_VARIABLE(variables[7], "IsRootMakefile", "TRUE", "bool");
396 ASSERT_VARIABLE(variables[8], "PlatformIs32Bit", "FALSE", "bool");
397 ASSERT_VARIABLE(variables[9], "PlatformIs64Bit", "FALSE", "bool");
398 ASSERT_VARIABLE(variables[10], "PlatformIsAppleEmbedded", "FALSE", "bool");
399 ASSERT_VARIABLE(variables[11], "PlatformIsx32", "FALSE", "bool");
400
401 auto none = cmDebugger::cmDebuggerVariablesHelper::CreateIfAny(
402 variablesManager, "Locals", true, static_cast<cmMakefile*>(nullptr));
403
404 ASSERT_TRUE(none == nullptr);
405
406 return true;
407}
408
409static bool testCreateFromStackFrame()
410{

Callers

nothing calls this directly

Calls 12

CreateDummiesFunction · 0.85
SetBinaryDirectoryMethod · 0.80
GetDirectoryIdMethod · 0.80
CreateVariablesRequestFunction · 0.70
GetStateSnapshotMethod · 0.45
GetStateMethod · 0.45
SetSourceDirectoryMethod · 0.45
getMethod · 0.45
GetIdMethod · 0.45
sizeMethod · 0.45
GetDirectoryMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…