================
@@ -66,20 +67,32 @@ TEST_F(VariablesTest, Clear_RemovesTemporaryKeepsPermanent) 
{
 }
 
 TEST_F(VariablesTest, GetTopLevelScope_ReturnsCorrectScope) {
-  vars.locals.Append(lldb::SBValue());
-  vars.globals.Append(lldb::SBValue());
-  vars.registers.Append(lldb::SBValue());
+  lldb::SBFrame frame;
+  uint32_t frame_id = 0;
 
-  EXPECT_EQ(vars.GetTopLevelScope(VARREF_LOCALS), &vars.locals);
-  EXPECT_EQ(vars.GetTopLevelScope(VARREF_GLOBALS), &vars.globals);
-  EXPECT_EQ(vars.GetTopLevelScope(VARREF_REGS), &vars.registers);
+  vars.ReadyFrame(frame_id, frame);
+
+  int64_t next_variable_ref = vars.GetNewVariableReference(false);
+
+  EXPECT_EQ(vars.GetTopLevelScope(next_variable_ref - 3),
+            vars.GetScope(frame_id, lldb_dap::ScopeKind::Locals));
+  EXPECT_EQ(vars.GetTopLevelScope(next_variable_ref - 2),
+            vars.GetScope(frame_id, lldb_dap::ScopeKind::Globals));
+  EXPECT_EQ(vars.GetTopLevelScope(next_variable_ref - 1),
+            vars.GetScope(frame_id, lldb_dap::ScopeKind::Registers));
----------------
Anthony-Eid wrote:

How's something like this?

https://github.com/Anthony-Eid/llvm-project/blob/1ae6545f7114d33226a4aa182b83a7cab7d13dd3/lldb/unittests/DAP/VariablesTest.cpp#L79-L100

https://github.com/llvm/llvm-project/pull/124232
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to