Skip to content

Commit 5817a2c

Browse files
committed
tests: Create regression testcase for #915
1 parent 94788a4 commit 5817a2c

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# regression https://github.com/tmux-python/tmuxp/issues/915
2+
session_name: target hyphen regression 915
3+
windows:
4+
- window_name: target hyphen regression 915
5+
layout: tiled
6+
panes:
7+
- shell_command:
8+
- echo "t - This echo's correctly."
9+
- shell_command:
10+
- echo "-a - This also echo's correctly."
11+
- shell_command:
12+
- echo "-t - This is never sent to the pane and instead printed to the current shell."

tests/workspace/test_builder.py

+39
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,45 @@ def test_window_options(
316316
w.select_layout(wconf["layout"])
317317

318318

319+
def test_regression_00915_pane_with_hyphen_t_target(
320+
tmp_path: pathlib.Path,
321+
server: "Server",
322+
capsys: pytest.CaptureFixture[str],
323+
) -> None:
324+
"""Regression test for send_keys in pane starting with -t."""
325+
yaml_config = (
326+
FIXTURE_PATH
327+
/ "workspace/builder"
328+
/ "regression_send_keys_with_hyphen_t_00915.yaml"
329+
)
330+
workspace = ConfigReader._from_file(yaml_config)
331+
workspace = loader.expand(workspace)
332+
333+
builder = WorkspaceBuilder(session_config=workspace, server=server)
334+
builder.build()
335+
336+
session = builder.session
337+
assert session is not None
338+
339+
window = session.active_window
340+
341+
assert window is not None
342+
343+
pane_1 = window.panes[0]
344+
assert "t - This echo's correctly." in pane_1.cmd("capture-pane", "-p").stdout[0]
345+
346+
pane_2 = window.panes[1]
347+
assert (
348+
"-a - This also echo's correctly." in pane_2.cmd("capture-pane", "-p").stdout[0]
349+
)
350+
351+
pane_3 = window.panes[2]
352+
assert (
353+
"-t - This is never sent to the pane and instead printed to the current shell."
354+
in pane_3.cmd("capture-pane", "-p").stdout[0]
355+
)
356+
357+
319358
@pytest.mark.flaky(reruns=5)
320359
def test_window_options_after(
321360
session: Session,

0 commit comments

Comments
 (0)