Skip to content

Commit 0145e78

Browse files
committed
fix(tests): skip format expansion test on tmux <3.2
Format expansion in style options (e.g., fg=#{...}) was added in tmux 3.2 (commit f03b6113). Earlier versions reject styles with format syntax as invalid. Verification from tmux source code: - Examined cmd-set-option.c in tmux 3.2 (commit f03b6113) - Found validation logic: styles WITH #{...} skip validation - Styles WITHOUT #{...} are still validated - In tmux <3.2, ALL styles are validated, rejecting #{...} syntax From commit f03b6113 message: "Any styles without a '#{' are still validated when they are set but any with a '#{' are not." From cmd-set-option.c after f03b6113: ```c if ((oe->flags & OPTIONS_TABLE_IS_STYLE) && strstr(value, "#{") == NULL && style_parse(&sy, &grid_default_cell, value) != 0) { ``` The test now only runs the format expansion check on tmux 3.2+. References: - tmux commit f03b6113 (style format expansion support) - cmd-set-option.c validation logic with strstr check
1 parent 1a579e2 commit 0145e78

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

tests/test_options.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -612,11 +612,12 @@ def test_style_option_validation(server: Server) -> None:
612612
# tmux <3.2: bold→bright
613613
assert style == "fg=colour240,bg=#525252,bright,underscore"
614614

615-
# Test style with variables
616-
session.set_option("status-style", "fg=#{?pane_in_mode,red,green}")
617-
style = session.show_option("status-style")
618-
assert isinstance(style, str)
619-
assert style == "fg=#{?pane_in_mode,red,green}"
615+
# Test style with variables (format expansion added in tmux 3.2)
616+
if has_gte_version("3.2"):
617+
session.set_option("status-style", "fg=#{?pane_in_mode,red,green}")
618+
style = session.show_option("status-style")
619+
assert isinstance(style, str)
620+
assert style == "fg=#{?pane_in_mode,red,green}"
620621

621622

622623
def test_option_error_handling(server: Server) -> None:

0 commit comments

Comments
 (0)