mirror of
https://github.com/jimeh/tmuxifier.git
synced 2026-02-19 09:56:39 +00:00
Make load-window within a session adhere to session_root setting
This should fix #61. Previously when you manually ran `tmuxifier load-window` from within a session created by Tmuxifier, the `session_root` path set in the session was ignored, and the new window would be cd'd to `$HOME` unless the window configuration had `window_root` set.
This commit is contained in:
@@ -23,6 +23,17 @@ unset window_root
|
||||
restore run_cmd
|
||||
|
||||
|
||||
# When only $TMUXIFIER_SESSION_ROOT is set, runs cd to $TMUXIFIER_SESSION_ROOT
|
||||
# path.
|
||||
stub run_cmd
|
||||
TMUXIFIER_SESSION_ROOT="/opt"
|
||||
__go_to_window_or_session_path
|
||||
assert 'stub_called_with_times run_cmd cd \"/opt\"' "1"
|
||||
assert 'stub_called_with_times run_cmd clear' "1"
|
||||
unset TMUXIFIER_SESSION_ROOT
|
||||
restore run_cmd
|
||||
|
||||
|
||||
# When only $session_root is set, runs cd to $session_root path.
|
||||
stub run_cmd
|
||||
session_root="/usr"
|
||||
@@ -45,5 +56,33 @@ unset session_root
|
||||
restore run_cmd
|
||||
|
||||
|
||||
# When $TMUXIFIER_SESSION_ROOT and $session_root are set, runs cd to
|
||||
# $TMUXIFIER_SESSION_ROOT path.
|
||||
stub run_cmd
|
||||
TMUXIFIER_SESSION_ROOT="/opt"
|
||||
session_root="/usr"
|
||||
__go_to_window_or_session_path
|
||||
assert 'stub_called_with_times run_cmd cd \"/opt\"' "1"
|
||||
assert 'stub_called_with_times run_cmd clear' "1"
|
||||
unset TMUXIFIER_SESSION_ROOT
|
||||
unset session_root
|
||||
restore run_cmd
|
||||
|
||||
|
||||
# When $window_root, $TMUXIFIER_SESSION_ROOT, and $session_root are set, runs
|
||||
# cd to $window_root path.
|
||||
stub run_cmd
|
||||
window_root="/tmp"
|
||||
TMUXIFIER_SESSION_ROOT="/opt"
|
||||
session_root="/usr"
|
||||
__go_to_window_or_session_path
|
||||
assert 'stub_called_with_times run_cmd cd \"/tmp\"' "1"
|
||||
assert 'stub_called_with_times run_cmd clear' "1"
|
||||
unset window_root
|
||||
unset TMUXIFIER_SESSION_ROOT
|
||||
unset session_root
|
||||
restore run_cmd
|
||||
|
||||
|
||||
# End of tests.
|
||||
assert_end "__go_to_window_or_session_path()"
|
||||
|
||||
Reference in New Issue
Block a user