mirror of
https://github.com/tmux/tmux.git
synced 2026-10-11 13:04:22 +00:00
Add pane_start_command_list to tests.
This commit is contained in:
@@ -133,6 +133,7 @@ pane_pipe_pid
|
|||||||
pane_right
|
pane_right
|
||||||
pane_search_string
|
pane_search_string
|
||||||
pane_start_command
|
pane_start_command
|
||||||
|
pane_start_command_list
|
||||||
pane_start_path
|
pane_start_path
|
||||||
pane_synchronized
|
pane_synchronized
|
||||||
pane_tabs
|
pane_tabs
|
||||||
@@ -343,6 +344,8 @@ test_var pane_at_top "1" -t "$TGT"
|
|||||||
test_var pane_at_left "1" -t "$TGT"
|
test_var pane_at_left "1" -t "$TGT"
|
||||||
test_var last_window_index "1" -t "$TGT"
|
test_var last_window_index "1" -t "$TGT"
|
||||||
test_var pid "$($TMUX display-message -p '#{pid}')" -t "$TGT"
|
test_var pid "$($TMUX display-message -p '#{pid}')" -t "$TGT"
|
||||||
|
test_var pane_start_command "cat" -t "$TGT"
|
||||||
|
test_var pane_start_command_list "'cat'" -t "$TGT"
|
||||||
|
|
||||||
# The grouped session is reported as such.
|
# The grouped session is reported as such.
|
||||||
test_var session_grouped "1" -t "cov:"
|
test_var session_grouped "1" -t "cov:"
|
||||||
@@ -384,5 +387,29 @@ esac
|
|||||||
[ -n "$($TMUX display-message -p '#{t/r:start_time}')" ] ||
|
[ -n "$($TMUX display-message -p '#{t/r:start_time}')" ] ||
|
||||||
fail "Empty #{t/r:start_time}."
|
fail "Empty #{t/r:start_time}."
|
||||||
|
|
||||||
|
# pane_start_command_list quotes each argv word for sh, so evaluating the
|
||||||
|
# expansion reconstructs the original argv exactly - including words with
|
||||||
|
# quotes, spaces, newlines and empty words. sh -c ignores the extra words
|
||||||
|
# (they become positional parameters), so the pane stays alive. -u stops
|
||||||
|
# the server sanitizing the newline away when printing to a non-UTF-8
|
||||||
|
# client (the test runs without a locale in the environment).
|
||||||
|
$TMUX new-session -d -s quot -x 80 -y 24 -- sh -c 'sleep 100' arg0 \
|
||||||
|
"it's a 'test'" 'two words' '' 'new
|
||||||
|
line' || fail "Failed to create quoting test session."
|
||||||
|
LIST=$($TMUX -u display-message -t 'quot:0.0' -p '#{pane_start_command_list}')
|
||||||
|
eval "set -- $LIST"
|
||||||
|
GOT=$(for a; do printf '<%s>' "$a"; done)
|
||||||
|
EXP=$(for a in sh -c 'sleep 100' arg0 "it's a 'test'" 'two words' '' 'new
|
||||||
|
line'; do printf '<%s>' "$a"; done)
|
||||||
|
if [ "$GOT" != "$EXP" ]; then
|
||||||
|
echo "pane_start_command_list did not round-trip."
|
||||||
|
echo "Expected: $EXP"
|
||||||
|
echo "But got: $GOT"
|
||||||
|
fail "Expansion was: $LIST"
|
||||||
|
fi
|
||||||
|
# A pane started with the default shell has an empty start command.
|
||||||
|
$TMUX new-window -d -t 'quot:' || fail "Failed to create shell window."
|
||||||
|
test_var pane_start_command_list "" -t "quot:1.0"
|
||||||
|
|
||||||
cleanup
|
cleanup
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
Reference in New Issue
Block a user