[Lldb-commits] [lldb] [lldb] Support format string in the prompt (PR #123430)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Sun Jan 19 23:55:33 PST 2025


================
@@ -69,6 +69,22 @@ def test_prompt_color(self):
         # Column: 1....6.8
         self.child.expect(re.escape("\x1b[31m(lldb) \x1b[0m\x1b[8G"))
 
+    @skipIfAsan
+    @skipIfEditlineSupportMissing
+    def test_prompt_format_color(self):
+        """Test that we can change the prompt color with a format string."""
+        self.launch(use_colors=True)
+        # Clear the prefix and suffix setting to simplify the output.
+        self.child.send('settings set prompt-ansi-prefix ""\n')
+        self.child.send('settings set prompt-ansi-suffix ""\n')
+        self.child.send('settings set prompt "${ansi.fg.red}(lldb)${ansi.normal} "\n')
+        self.child.send("foo")
+        # Make sure this change is reflected immediately. Check that the color
+        # is set (31) and the cursor position (8) is correct.
+        # Prompt: (lldb) _
+        # Column: 1....6.8
+        self.child.expect(re.escape("\x1b[31m(lldb)\x1b[0m foo"))
----------------
labath wrote:

The precommit failure appears to be genuine. The required string is present in the output, but for some reason this line starts searching after it. My suggested change may or may not fix it.

https://github.com/llvm/llvm-project/pull/123430


More information about the lldb-commits mailing list