Skip to content

Commit f2aad40

Browse files
JDevliegherejoaosaffran
authored andcommitted
[lldb] Add a test for terminal dimensions (llvm#126598)
Add a test for the `term-width` and `term-height` settings. I thought I was hitting bug because in my statusline test I was getting the default values when running under PExpect. It turned out hat the issue is that we clear the settings at the start of the test. The Editline tests aren't affected by this because Editline provides its own functions to get the terminal dimensions and explicitly does not rely on LLDB's settings (presumably exactly because of this behavior).
1 parent 76791ba commit f2aad40

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import lldb
2+
from lldbsuite.test.decorators import *
3+
from lldbsuite.test.lldbtest import *
4+
from lldbsuite.test import lldbutil
5+
from lldbsuite.test.lldbpexpect import PExpectTest
6+
7+
8+
class TerminalDimensionsTest(PExpectTest):
9+
NO_DEBUG_INFO_TESTCASE = True
10+
11+
@skipIfAsan
12+
def test(self):
13+
"""Test that the lldb driver correctly reports the (PExpect) terminal dimension."""
14+
self.launch(dimensions=(40, 40))
15+
16+
# Tests clear all the settings so we lose the launch values. Resize the
17+
# window to update the settings. These new values need to be different
18+
# to trigger a SIGWINCH.
19+
self.child.setwinsize(20, 60)
20+
21+
self.expect("settings show term-height", ["term-height (unsigned) = 20"])
22+
self.expect("settings show term-width", ["term-width (unsigned) = 60"])

0 commit comments

Comments
 (0)