From 6b2d850e541cd02fe2e6fec355fb4319d48ff272 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Thu, 27 Apr 2017 13:09:08 +0100 Subject: [PATCH] Tests for some new session and new window bits. --- regress/new-session-base-index.sh | 27 +++++++++++++++ regress/new-session-command.sh | 25 ++++++++++++++ regress/new-session-environment.sh | 54 ++++++++++++++++++++++++++++++ regress/new-window-command.sh | 26 ++++++++++++++ 4 files changed, 132 insertions(+) create mode 100644 regress/new-session-base-index.sh create mode 100644 regress/new-session-command.sh create mode 100644 regress/new-session-environment.sh create mode 100644 regress/new-window-command.sh diff --git a/regress/new-session-base-index.sh b/regress/new-session-base-index.sh new file mode 100644 index 00000000..337037c3 --- /dev/null +++ b/regress/new-session-base-index.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +# new session base-index + +PATH=/bin:/usr/bin +TERM=screen + +[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux) +TMUX="$TEST_TMUX -Ltest" +$TMUX kill-server 2>/dev/null + +TMP=$(mktemp) +trap "rm -f $TMP" 0 1 15 + +cat <$TMP +set -g base-index 100 +new +set base-index 200 +neww +EOF + +$TMUX -f$TMP start +echo $($TMUX lsw -F'#{window_index}') >$TMP +(echo "100 200"|cmp -s - $TMP) || exit 1 +$TMUX kill-server 2>/dev/null + +exit 0 diff --git a/regress/new-session-command.sh b/regress/new-session-command.sh new file mode 100644 index 00000000..02ba55d9 --- /dev/null +++ b/regress/new-session-command.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +# new session command + +PATH=/bin:/usr/bin +TERM=screen + +[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux) +TMUX="$TEST_TMUX -Ltest" +$TMUX kill-server 2>/dev/null + +TMP=$(mktemp) +trap "rm -f $TMP" 0 1 15 + +cat <$TMP +new sleep 101 +new -- sleep 102 +new "sleep 103" +EOF + +$TMUX -f$TMP start +[ $($TMUX ls|wc -l) -eq 3 ] || exit 1 +$TMUX kill-server 2>/dev/null + +exit 0 diff --git a/regress/new-session-environment.sh b/regress/new-session-environment.sh new file mode 100644 index 00000000..52198d12 --- /dev/null +++ b/regress/new-session-environment.sh @@ -0,0 +1,54 @@ +#!/bin/sh + +# new session environment + +PATH=/bin:/usr/bin +TERM=screen + +[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux) +TMUX="$TEST_TMUX -Ltest" +$TMUX kill-server 2>/dev/null + +TMP=$(mktemp) +SCRIPT=$(mktemp) +trap "rm -f $TMP $SCRIPT" 0 1 15 + +cat <$SCRIPT +( +echo TERM=\$TERM +echo PWD=\$(pwd) +echo PATH=\$PATH +echo SHELL=\$SHELL +echo TEST=\$TEST +) >$TMP +EOF + +cat <$TMP +new -- /bin/sh $SCRIPT +EOF + +(cd /; env -i TERM=ansi TEST=test1 PATH=1 SHELL=/bin/sh \ + $TMUX -f$TMP start) || exit 1 +sleep 1 +(cat </dev/null + +exit 0 diff --git a/regress/new-window-command.sh b/regress/new-window-command.sh new file mode 100644 index 00000000..176bffb5 --- /dev/null +++ b/regress/new-window-command.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +# new session command + +PATH=/bin:/usr/bin +TERM=screen + +[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux) +TMUX="$TEST_TMUX -Ltest" +$TMUX kill-server 2>/dev/null + +TMP=$(mktemp) +trap "rm -f $TMP" 0 1 15 + +cat <$TMP +new +neww sleep 101 +neww -- sleep 102 +neww "sleep 103" +EOF + +$TMUX -f$TMP start +[ $($TMUX lsw|wc -l) -eq 4 ] || exit 1 +$TMUX kill-server 2>/dev/null + +exit 0