Skip to content

Commit 494da06

Browse files
committed
!squash test_options: Stable baseline
1 parent 4c9ba99 commit 494da06

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

tests/test_options.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,3 +452,55 @@ def test_show_option_pane_fixture(
452452
assert k in result
453453

454454
assert result[k] == v
455+
456+
457+
def test_stable_baseline_options_and_hooks(server: "Server") -> None:
458+
"""Ensure stable baseline across tmux versions."""
459+
session = server.new_session(session_name="test", detach=True)
460+
461+
# List variables
462+
assert server.show_option("command-alias") == {
463+
"choose-session": "choose-tree -s",
464+
"choose-window": "choose-tree -w",
465+
"info": "show-messages -JT",
466+
"server-info": "show-messages -JT",
467+
"split-pane": "split-window",
468+
"splitp": "split-window",
469+
}
470+
assert server.show_option("terminal-features") == {
471+
"screen*": [
472+
"title",
473+
],
474+
"xterm*": [
475+
"clipboard",
476+
"ccolour",
477+
"cstyle",
478+
"focus",
479+
"title",
480+
],
481+
}
482+
assert server.show_option("terminal-overrides") is None
483+
assert server.show_option("user-keys") is None
484+
assert server.show_option("status-format") is None
485+
assert server.show_option("update-environment") is None
486+
487+
# List variables: Pane
488+
pane = session.active_pane
489+
assert pane is not None
490+
assert pane.show_option("pane-colours") is None
491+
492+
493+
def test_high_level_api_expectations(server: "Server") -> None:
494+
"""Ensure options and hooks behave as expected."""
495+
496+
# Raw input and output
497+
# Should be able to functionally parse raw CLI output, even outside of libtmux into
498+
# options.
499+
500+
# Parsing steps
501+
# 1. Basic KV split: Should split options into key,values.
502+
# 2. Structure: Should decompose array-like options and dictionaries
503+
# In the case of sparse arrays, which don't exist in Python, a TmuxArray is used
504+
# that behaves like a list but allows for sparse indexes so the indices aren't
505+
# lost but the shape is still respected.
506+
# 3. Python Typings: Should cast the fully structured objects into types

0 commit comments

Comments
 (0)