|
3 | 3 | """ |
4 | 4 |
|
5 | 5 | import dap_server |
| 6 | +import lldbdap_testcase |
| 7 | +from lldbsuite.test import lldbutil |
6 | 8 | from lldbsuite.test.decorators import * |
7 | 9 | from lldbsuite.test.lldbtest import * |
8 | | -from lldbsuite.test import lldbutil |
9 | | -import lldbdap_testcase |
10 | 10 |
|
11 | 11 |
|
12 | 12 | class TestDAP_console(lldbdap_testcase.DAPTestCaseBase): |
13 | | - def check_lldb_command(self, lldb_command, contains_string, assert_msg): |
| 13 | + def check_lldb_command( |
| 14 | + self, lldb_command, contains_string, assert_msg, command_escape_prefix="`" |
| 15 | + ): |
14 | 16 | response = self.dap_server.request_evaluate( |
15 | | - "`%s" % (lldb_command), context="repl" |
| 17 | + f"{command_escape_prefix}{lldb_command}", context="repl" |
16 | 18 | ) |
17 | 19 | output = response["body"]["result"] |
18 | 20 | self.assertIn( |
@@ -68,3 +70,37 @@ def test_scopes_variables_setVariable_evaluate(self): |
68 | 70 | # currently selected frame. |
69 | 71 |
|
70 | 72 | self.check_lldb_command("frame select", "frame #1", "frame 1 is selected") |
| 73 | + |
| 74 | + @skipIfWindows |
| 75 | + @skipIfRemote |
| 76 | + def test_custom_escape_prefix(self): |
| 77 | + program = self.getBuildArtifact("a.out") |
| 78 | + self.build_and_launch(program, commandEscapePrefix="::") |
| 79 | + source = "main.cpp" |
| 80 | + breakpoint1_line = line_number(source, "// breakpoint 1") |
| 81 | + breakpoint_ids = self.set_source_breakpoints(source, [breakpoint1_line]) |
| 82 | + self.continue_to_breakpoints(breakpoint_ids) |
| 83 | + |
| 84 | + self.check_lldb_command( |
| 85 | + "help", |
| 86 | + "For more information on any command", |
| 87 | + "Help can be invoked", |
| 88 | + command_escape_prefix="::", |
| 89 | + ) |
| 90 | + |
| 91 | + @skipIfWindows |
| 92 | + @skipIfRemote |
| 93 | + def test_empty_escape_prefix(self): |
| 94 | + program = self.getBuildArtifact("a.out") |
| 95 | + self.build_and_launch(program, commandEscapePrefix="") |
| 96 | + source = "main.cpp" |
| 97 | + breakpoint1_line = line_number(source, "// breakpoint 1") |
| 98 | + breakpoint_ids = self.set_source_breakpoints(source, [breakpoint1_line]) |
| 99 | + self.continue_to_breakpoints(breakpoint_ids) |
| 100 | + |
| 101 | + self.check_lldb_command( |
| 102 | + "help", |
| 103 | + "For more information on any command", |
| 104 | + "Help can be invoked", |
| 105 | + command_escape_prefix="", |
| 106 | + ) |
0 commit comments