Skip to content

Commit 83b4530

Browse files
committed
[lldb] add test for toggling use-colors
Signed-off-by: Ebuka Ezike <[email protected]>
1 parent 0487d12 commit 83b4530

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

lldb/test/API/terminal/TestEditline.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,26 @@ def test_prompt_no_color(self):
9595
self.child.send("foo")
9696
# Check that there are no escape codes.
9797
self.child.expect(re.escape("\n(lldb) foo"))
98+
99+
@skipIfAsan
100+
@skipIfEditlineSupportMissing
101+
def test_enable_and_disable_color(self):
102+
"""Test that when we change the color during debugging it applies the changes"""
103+
# launch with colors enabled.
104+
self.launch(use_colors=True)
105+
self.child.send('settings set prompt-ansi-prefix "${ansi.fg.red}"\n')
106+
self.child.expect(re.escape("\x1b[31m(lldb) \x1b[0m\x1b[8G"))
107+
108+
# set use color to false.
109+
self.child.send("settings set use-color false\n")
110+
111+
# check that there is no color.
112+
self.child.send("foo\n")
113+
self.child.expect(re.escape("(lldb) foo"))
114+
115+
# set use-color to true
116+
self.child.send("settings set use-color true\n")
117+
118+
# check that there is colors;
119+
self.child.send("foo")
120+
self.child.expect(re.escape("\x1b[31m(lldb) \x1b[0m\x1b[8Gfoo"))

0 commit comments

Comments
 (0)