Skip to content

Commit 0995d26

Browse files
committed
fix(test_pane): add capture_pane test
1 parent 3c0d700 commit 0995d26

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/test_pane.py

+21
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,24 @@ def test_set_width(session: Session) -> None:
6363
assert int(pane1["pane_width"]) == 10
6464

6565
pane1.reset()
66+
67+
68+
def test_capture_pane(session: Session) -> None:
69+
session.new_window(
70+
attach=True,
71+
window_name="capture_pane",
72+
window_shell='env -i PS1="$ " /usr/bin/env bash --norc --noprofile'
73+
)
74+
pane = session.attached_window.attached_pane
75+
assert pane is not None
76+
pane_contents = "\n".join(pane.capture_pane())
77+
assert pane_contents == '$'
78+
pane.send_keys(
79+
r'printf "\n%s\n" "Hello World !"',
80+
literal=True,
81+
suppress_history=False
82+
)
83+
pane_contents = "\n".join(pane.capture_pane())
84+
assert pane_contents == r'$ printf "\n%s\n" "Hello World !"{}'.format(
85+
'\n\nHello World !\n$'
86+
)

0 commit comments

Comments
 (0)