mirror of
https://github.com/jimeh/tmuxifier.git
synced 2026-02-19 09:56:39 +00:00
Add tests for __go_to_session layout helper
This commit is contained in:
32
test/lib/layout-helpers/__go_to_session-test.sh
Executable file
32
test/lib/layout-helpers/__go_to_session-test.sh
Executable file
@@ -0,0 +1,32 @@
|
||||
#! /usr/bin/env bash
|
||||
source "../../test-helper.sh"
|
||||
source "${root}/lib/layout-helpers.sh"
|
||||
|
||||
#
|
||||
# __go_to_session() tests.
|
||||
#
|
||||
|
||||
# Setup.
|
||||
session="tmuxifier-test-session"
|
||||
|
||||
# When TMUX is not set, attach to $session.
|
||||
stub tmuxifier-tmux
|
||||
__go_to_session
|
||||
assert_raises \
|
||||
"stub_called_with tmuxifier-tmux -u attach-session -t \"${session}:\"" 0
|
||||
restore tmuxifier-tmux
|
||||
|
||||
# When TMUX is set, switch to $session.
|
||||
TMUX="/tmp/tmux-501/default,1203,0"
|
||||
stub tmuxifier-tmux
|
||||
__go_to_session
|
||||
assert_raises \
|
||||
"stub_called_with tmuxifier-tmux -u switch-client -t \"${session}:\"" 0
|
||||
restore tmuxifier-tmux
|
||||
unset TMUX
|
||||
|
||||
# Tear down.
|
||||
unset session
|
||||
|
||||
# End of tests.
|
||||
assert_end "__go_to_session()"
|
||||
Reference in New Issue
Block a user