Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gblackburn/regression target sendkeys 00915 #917

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# regression https://github.com/tmux-python/tmuxp/issues/915
session_name: target hyphen regression 915
windows:
- window_name: target hyphen regression 915
layout: tiled
panes:
- shell_command:
- echo "t - This echo's correctly."
- shell_command:
- echo "-a - This also echo's correctly."
- shell_command:
- echo "-t - This is never sent to the pane and instead printed to the current shell."
51 changes: 51 additions & 0 deletions tests/workspace/test_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,57 @@ def test_window_options(
w.select_layout(wconf["layout"])


def test_regression_00915_pane_with_hyphen_t_target(
tmp_path: pathlib.Path,
server: "Server",
capsys: pytest.CaptureFixture[str],
) -> None:
"""Regression test for send_keys in pane starting with -t."""
yaml_config = (
FIXTURE_PATH
/ "workspace/builder"
/ "regression_send_keys_with_hyphen_t_00915.yaml"
)
workspace = ConfigReader._from_file(yaml_config)
workspace = loader.expand(workspace)

builder = WorkspaceBuilder(session_config=workspace, server=server)

# Create a session using the template
builder.build()
# Then append the template again
builder.build(builder.session, append=True)

session = builder.session
assert session is not None

# Check the panes added when created the session
pane_1 = session.windows[0].panes[0]
assert "t - This echo's correctly." in pane_1.cmd("capture-pane", "-p").stdout[0]
pane_2 = session.windows[0].panes[1]
assert (
"-a - This also echo's correctly." in pane_2.cmd("capture-pane", "-p").stdout[0]
)
pane_3 = session.windows[0].panes[2]
assert (
"-t - This is never sent to the pane and instead printed to the current shell."
in pane_3.cmd("capture-pane", "-p").stdout[0]
)

# Check the panes in the appended window
pane_1 = session.windows[1].panes[0]
assert "t - This echo's correctly." in pane_1.cmd("capture-pane", "-p").stdout[0]
pane_2 = session.windows[1].panes[1]
assert (
"-a - This also echo's correctly." in pane_2.cmd("capture-pane", "-p").stdout[0]
)
pane_3 = session.windows[1].panes[2]
assert (
"-t - This is never sent to the pane and instead printed to the current shell."
in pane_3.cmd("capture-pane", "-p").stdout[0]
)


@pytest.mark.flaky(reruns=5)
def test_window_options_after(
session: Session,
Expand Down