| 261 | } |
| 262 | |
| 263 | static bool testCreateFromTests() |
| 264 | { |
| 265 | auto variablesManager = |
| 266 | std::make_shared<cmDebugger::cmDebuggerVariablesManager>(); |
| 267 | |
| 268 | auto dummies = CreateDummies("Foo"); |
| 269 | cmTest test1 = cmTest(dummies.Makefile.get()); |
| 270 | test1.SetName("Test1"); |
| 271 | test1.SetOldStyle(false); |
| 272 | test1.SetCommandExpandLists(true); |
| 273 | test1.SetCommand(std::vector<std::string>{ "Foo1", "arg1" }); |
| 274 | test1.SetProperty("Prop1", "Prop1"); |
| 275 | cmTest test2 = cmTest(dummies.Makefile.get()); |
| 276 | test2.SetName("Test2"); |
| 277 | test2.SetOldStyle(false); |
| 278 | test2.SetCommandExpandLists(false); |
| 279 | test2.SetCommand(std::vector<std::string>{ "Bar1", "arg1", "arg2" }); |
| 280 | test2.SetProperty("Prop2", "Prop2"); |
| 281 | test2.SetProperty("Prop3", "Prop3"); |
| 282 | |
| 283 | std::vector<cmTest*> tests = { &test1, &test2 }; |
| 284 | |
| 285 | auto vars = cmDebugger::cmDebuggerVariablesHelper::CreateIfAny( |
| 286 | variablesManager, "Locals", true, tests); |
| 287 | |
| 288 | dap::array<dap::Variable> variables = |
| 289 | variablesManager->HandleVariablesRequest( |
| 290 | CreateVariablesRequest(vars->GetId())); |
| 291 | |
| 292 | ASSERT_TRUE(vars->GetValue() == std::to_string(tests.size())); |
| 293 | ASSERT_TRUE(variables.size() == 2); |
| 294 | ASSERT_VARIABLE_REFERENCE_NOT_ZERO(variables[0], test1.GetName(), "", |
| 295 | "collection"); |
| 296 | ASSERT_VARIABLE_REFERENCE_NOT_ZERO(variables[1], test2.GetName(), "", |
| 297 | "collection"); |
| 298 | |
| 299 | dap::array<dap::Variable> testVariables = |
| 300 | variablesManager->HandleVariablesRequest( |
| 301 | CreateVariablesRequest(variables[0].variablesReference)); |
| 302 | ASSERT_TRUE(testVariables.size() == 5); |
| 303 | ASSERT_VARIABLE_REFERENCE_NOT_ZERO(testVariables[0], "Command", |
| 304 | std::to_string(test1.GetCommand().size()), |
| 305 | "collection"); |
| 306 | ASSERT_VARIABLE(testVariables[1], "CommandExpandLists", |
| 307 | BOOL_STRING(test1.GetCommandExpandLists()), "bool"); |
| 308 | ASSERT_VARIABLE(testVariables[2], "Name", test1.GetName(), "string"); |
| 309 | ASSERT_VARIABLE(testVariables[3], "OldStyle", |
| 310 | BOOL_STRING(test1.GetOldStyle()), "bool"); |
| 311 | ASSERT_VARIABLE_REFERENCE_NOT_ZERO(testVariables[4], "Properties", "1", |
| 312 | "collection"); |
| 313 | |
| 314 | dap::array<dap::Variable> commandVariables = |
| 315 | variablesManager->HandleVariablesRequest( |
| 316 | CreateVariablesRequest(testVariables[0].variablesReference)); |
| 317 | ASSERT_TRUE(commandVariables.size() == test1.GetCommand().size()); |
| 318 | for (size_t i = 0; i < commandVariables.size(); ++i) { |
| 319 | ASSERT_VARIABLE(commandVariables[i], "[" + std::to_string(i) + "]", |
| 320 | test1.GetCommand()[i], "string"); |
nothing calls this directly
no test coverage detected
searching dependent graphs…