fix: log broadcast says 'this party' again
Routing log_notify through .party-notify had turned the announcement into 'started logging the party'. The helper takes an optional object phrase, defaulting to 'the party' for the join/leave hooks, and log_notify passes 'this party'. Both wordings are now pinned by stub tests, which had no coverage of the broadcast text before.
This commit is contained in:
parent
733633bd65
commit
471ee5875c
2 changed files with 34 additions and 8 deletions
|
|
@ -43,6 +43,11 @@ case "$*" in
|
|||
# party process while it waits on us, mid-setup.
|
||||
[ -n "${SIGNAL_ON_NEWSESSION:-}" ] && kill -TERM "$PPID"
|
||||
;;
|
||||
*"list-clients -F #{client_name}"*)
|
||||
# Optional injection point for the broadcast tests: pretend one
|
||||
# client is attached so the notify fan-out has someone to message.
|
||||
[ -n "${FAKE_CLIENT:-}" ] && echo "$FAKE_CLIENT"
|
||||
;;
|
||||
*"display-message -p "*)
|
||||
# Caller is fishing for #{pid}; emit the sleeper's PID.
|
||||
echo "$FAKE_SERVER_PID"
|
||||
|
|
@ -872,3 +877,23 @@ STUB
|
|||
[[ "$output" == *"solo"*"[group=$TMUX_PARTY_GROUP]"* ]]
|
||||
[[ "$output" == *"duo"*"[group=$other]"* ]]
|
||||
}
|
||||
|
||||
@test "log start and stop are announced to attached clients" {
|
||||
"$PARTY_BIN" host taped
|
||||
export FAKE_CLIENT=/dev/pts/99
|
||||
|
||||
run "$PARTY_BIN" log
|
||||
[ "$status" -eq 0 ]
|
||||
grep -q "display-message -c /dev/pts/99 $USER started logging this party$" "$TMUX_LOG"
|
||||
|
||||
run "$PARTY_BIN" log --stop
|
||||
[ "$status" -eq 0 ]
|
||||
grep -q "display-message -c /dev/pts/99 $USER stopped logging this party$" "$TMUX_LOG"
|
||||
}
|
||||
|
||||
@test "join/leave broadcast keeps its default wording" {
|
||||
"$PARTY_BIN" host greet
|
||||
party_dir="$PARTY_SOCKET_DIR/party-$USER:greet.d"
|
||||
FAKE_CLIENT=/dev/pts/99 "$party_dir/.party-notify" "$party_dir/sock" alice joined
|
||||
grep -q "display-message -c /dev/pts/99 alice joined the party$" "$TMUX_LOG"
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue