Skip to content

Commit ee17439

Browse files
committed
Add test case for window_options_after
1 parent fc7aae9 commit ee17439

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
session_name: tmuxp test window_options_after
2+
options:
3+
default-shell: /bin/sh
4+
default-command: /bin/sh
5+
windows:
6+
- window_name: test
7+
panes:
8+
- echo 0
9+
- echo 1
10+
options_after:
11+
synchronize-panes: on

tests/test_workspacebuilder.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,34 @@ def test_window_options(session):
259259
w.select_layout(wconf['layout'])
260260

261261

262+
def test_window_options_after(session):
263+
yaml_config = loadfixture("workspacebuilder/window_options_after.yaml")
264+
s = session
265+
sconfig = kaptan.Kaptan(handler='yaml')
266+
sconfig = sconfig.import_config(yaml_config).get()
267+
sconfig = config.expand(sconfig)
268+
269+
builder = WorkspaceBuilder(sconf=sconfig)
270+
builder.build(session=session)
271+
272+
def assert_last_line(p, s):
273+
# Print output for easier debugging if test fails
274+
print('\n'.join(p.cmd('capture-pane', '-p').stdout))
275+
assert p.cmd('capture-pane', '-p').stdout[-2] == s
276+
277+
for i, pane in enumerate(session.attached_window.panes):
278+
assert_last_line(pane, str(i))
279+
pane.cmd('send-keys', 'Up') # Will repeat echo
280+
pane.enter() # in each iteration
281+
assert_last_line(pane, str(i))
282+
283+
session.cmd('send-keys', 'echo moo')
284+
session.cmd('send-keys', 'Enter')
285+
286+
for pane in session.attached_window.panes:
287+
assert_last_line(pane, 'moo')
288+
289+
262290
def test_window_shell(session):
263291
yaml_config = loadfixture("workspacebuilder/window_shell.yaml")
264292
s = session

0 commit comments

Comments
 (0)