dotfiles/.local/bin/test/tm.bats
Marty Oehme 7fab7dd6fb [tmux] Add remote session nesting
If calling a tmux session within a tmux session, pressing F12 will
toggle between sending commands to the outer or inner session. If the
outer session is inactive its status-bar will be slightly greyed out to
show that no commands will reach it. If the inner session is a remote
ssh session, it will set some additional stylings for the status-bar to
further differentiate the two.
2019-07-27 12:29:47 +00:00

39 lines
994 B
Bash

setup() {
fut="$BATS_TEST_DIRNAME/../tm"
}
teardown() {
rm -rf $BATS_TMPDIR/xdg/*
}
@test "runs correctly if invoked without arguments" {
run $fut
echo "$BATS_TEST_DIRNAME/../tm"
[ "$status" -eq 0 ]
}
@test "Errors out if passed a non-existent session file (and some session name)" {
run $fut IDONT_EXIST_HERE.session sessionname
echo "STATUS: $output"
[ "$status" -eq 1 ]
echo "OUTPUT: $output"
[ "$output" = "can not source session file: 'IDONT_EXIST_HERE.session' does not exist." ]
}
@test "Runs without errors when session file exists in PWD" {
touch $PWD/exists.session
run $fut exists.session sessionname
rm $PWD/exists.session
[ "$status" -eq 0 ]
}
@test "Runs without errors when session file exists in XDG_CONFIG_HOME/tmux/sessions/" {
export XDG_CONFIG_HOME=$BATS_TMPDIR
mkdir -p $XDG_CONFIG_HOME/tmux/sessions
sesdir=$XDG_CONFIG_HOME/tmux/sessions
touch $sesdir/exists.session
run $fut exists.session sessionname
[ "$status" -eq 0 ]
}