Add small script test.

This commit is contained in:
Dave Davenport 2014-08-31 10:37:12 +02:00
parent ad1cede6f5
commit 5d5b4aac9f
4 changed files with 40 additions and 1 deletions

5
.gitignore vendored
View File

@ -10,4 +10,7 @@ aclocal.m4
autom4te.cache/
compile
depcomp
*.o
*.gcov
*.gcda
*.gcno

View File

@ -42,3 +42,4 @@ test: ${bin_PROGRAMS}
$(top_srcdir)/test/run_test.sh 202 $(top_srcdir)/test/run_dmenu_test.sh $(top_builddir)
$(top_srcdir)/test/run_test.sh 203 $(top_srcdir)/test/run_dmenu_custom_test.sh $(top_builddir)
$(top_srcdir)/test/run_test.sh 204 $(top_srcdir)/test/run_run_test.sh $(top_builddir)
$(top_srcdir)/test/run_test.sh 205 $(top_srcdir)/test/run_script_test.sh $(top_builddir)

25
test/run_script_test.sh Executable file
View File

@ -0,0 +1,25 @@
#!/usr/bin/env bash
SP=$(readlink -f "$0")
DIR=$(dirname "$SP")
echo $DIR
# wait till it is up, run rofi with error message
sleep 1;
rofi -switchers "custom:$DIR/test_script.sh" -show custom &
RPID=$!
# send enter.
sleep 5;
xdotool key 'Down'
sleep 0.4
xdotool key Return
# Get result, kill xvfb
wait ${RPID}
RETV=$?
OUTPUT=$(cat output.txt | tr '\n' ' ')
if [ "${OUTPUT}" != 'noot ' ]
then
exit 1
fi
exit ${RETV}

10
test/test_script.sh Executable file
View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
if [ -z "$1" ]
then
echo "aap"
echo "noot"
echo "mies"
else
echo $1 > output.txt
fi