brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · c6f5994 Raw
53 lines · python
1"""2Test lldb-dap repl mode detection3"""4 5import lldbdap_testcase6import dap_server7from lldbsuite.test import lldbutil8from lldbsuite.test.decorators import *9from lldbsuite.test.lldbtest import *10 11 12class TestDAP_repl_mode_detection(lldbdap_testcase.DAPTestCaseBase):13    def assertEvaluate(self, expression, regex):14        self.assertRegex(15            self.dap_server.request_evaluate(expression, context="repl")["body"][16                "result"17            ],18            regex,19        )20 21    def test_completions(self):22        program = self.getBuildArtifact("a.out")23        self.build_and_launch(program)24 25        source = "main.cpp"26        breakpoint1_line = line_number(source, "// breakpoint 1")27        breakpoint2_line = line_number(source, "// breakpoint 2")28 29        self.set_source_breakpoints(source, [breakpoint1_line, breakpoint2_line])30 31        # The result of the commands should return the empty string.32        self.assertEvaluate("`command regex user_command s/^$/platform/", r"^$")33        self.assertEvaluate("`command alias alias_command platform", r"^$")34        self.assertEvaluate(35            "`command alias alias_command_with_arg platform select --sysroot %1 remote-linux",36            r"^$",37        )38 39        self.continue_to_next_stop()40        self.assertEvaluate("user_command", "474747")41        self.assertEvaluate("alias_command", "474747")42        self.assertEvaluate("alias_command_with_arg", "474747")43        self.assertEvaluate("platform", "474747")44 45        self.continue_to_next_stop()46        platform_help_needle = "Commands to manage and create platforms"47        self.assertEvaluate("user_command", platform_help_needle)48        self.assertEvaluate("alias_command", platform_help_needle)49        self.assertEvaluate(50            "alias_command_with_arg " + self.getBuildDir(), "Platform: remote-linux"51        )52        self.assertEvaluate("platform", platform_help_needle)53