diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-06 02:20:21 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-06 02:20:21 +0000 |
commit | ef3904423d3301d87b4b499b7e5feb359d622405 (patch) | |
tree | 981032c10096a70b0cb95ea74de48492f9f08251 /debian/tests/t/boilerplate.sh | |
parent | Adding upstream version 4.6.2. (diff) | |
download | screen-ef3904423d3301d87b4b499b7e5feb359d622405.tar.xz screen-ef3904423d3301d87b4b499b7e5feb359d622405.zip |
Adding debian version 4.6.2-3+deb10u1.debian/4.6.2-3+deb10u1debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/tests/t/boilerplate.sh')
-rw-r--r-- | debian/tests/t/boilerplate.sh | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/debian/tests/t/boilerplate.sh b/debian/tests/t/boilerplate.sh new file mode 100644 index 0000000..8b28d59 --- /dev/null +++ b/debian/tests/t/boilerplate.sh @@ -0,0 +1,49 @@ +# -*- sh -*- + +TESTNAME=`basename $0`.`mktemp -u XXXXXXXX` +SCREEN="screen -S $TESTNAME" +SCREENRC=/dev/null +export SCREENRC +count=0 + +check_exit_code_true() { + if [ "$?" != 0 ]; then echo -n 'not '; fi; echo ok $(( count+=1 )) - "$@" +} + +check_exit_code_false() { + if [ "$?" = 0 ]; then echo -n 'not '; fi; echo ok $(( count+=1 )) - "$@" +} + +has_session_with_testname() { + screen -ls | fgrep -q "$TESTNAME" +} + +session_exists_2_tests() { + screen -ls | fgrep -q '(Detached)' + check_exit_code_true Detached session found + + has_session_with_testname + check_exit_code_true Session has expected session name +} + +create_session_3_tests() { + $SCREEN -d -m "$@" + check_exit_code_true Create session + + sleep 1 + + session_exists_2_tests +} + +kill_session_2_tests() { + $SCREEN -X quit + check_exit_code_true Quit command sent to session + + has_session_with_testname + check_exit_code_false Session is gone +} + +has_window_number_zero() { + $SCREEN -Q windows | egrep -q '^0 ' + check_exit_code_true Session has a window with id 0 +} |