================ @@ -0,0 +1,138 @@ +""" +Test lldb-dap gotoTarget request +""" + +from typing import Dict, Any +from unittest import SkipTest + +from lldbsuite.test.lldbtest import line_number +import lldbdap_testcase +import os + + +class TestDAP_gotoTargets(lldbdap_testcase.DAPTestCaseBase): + def verify_variable( + self, actual_dict: Dict[str, Any], expected_dict: Dict[str, Any] + ): + for key, value in expected_dict.items(): + actual_value = actual_dict[key] + self.assertEqual( + actual_value, + value, + f"values does not match for key: `{key}` expected_value: `{value}`, actual_value: `{actual_value}`", + ) + + def test_default(self): + """ + Tests the jump to cursor of a simple program. No arguments, + environment, or anything else is specified. + This does not run any statement between the current breakpoint + and the jump line location. + """ + program = self.getBuildArtifact("a.out") + self.build_and_launch(program) + + source_file = "main.c" + self.source_path = os.path.join(os.getcwd(), source_file) + self.set_source_breakpoints( + source_file, [line_number(source_file, "// breakpoint 1")] + ) + self.continue_to_next_stop() + + first_var_1_object = self.dap_server.get_local_variable("var_1") + self.assertEqual(first_var_1_object["value"], "10") + + goto_line = line_number(source_file, "// goto 1") + goto_column = 1 + response = self.dap_server.request_gotoTargets( + source_file, self.source_path, goto_line, goto_column + ) + + self.assertEqual( + response["success"], True, "expects success when request for targets" + ) + target = response["body"]["targets"][0] + self.assertGreaterEqual( + target["id"], 0, "targetId should be greater than or equal to zero" + ) + + target_id = target["id"] + thread_id = self.dap_server.get_thread_id() + self.assertIsNotNone(thread_id, "threadId should not be none") + + response = self.dap_server.request_goto(thread_id, target_id) + self.assertEqual(response["success"], True, "expects success to go to targetId") ---------------- vogelsgesang wrote:
```suggestion self.assertEqual(response["success"], True, "goto request with targetId should be successful") ``` https://github.com/llvm/llvm-project/pull/130503 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits