Skip to content

Commit f899adf

Browse files
committed
!squash test_options: Stable baseline
1 parent c068d1a commit f899adf

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

tests/test_options.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,3 +454,56 @@ def test_show_option_pane_fixture(
454454
assert k in result
455455

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

0 commit comments

Comments
 (0)