Test glob/regex.

This commit is contained in:
Dave Davenport 2016-01-01 11:31:29 +01:00
parent 5a3c202423
commit 4fbbce891b
3 changed files with 62 additions and 0 deletions

View File

@ -196,6 +196,10 @@ test-x: ${bin_PROGRAMS}
$(top_srcdir)/test/run_test.sh 213 $(top_srcdir)/test/run_drun_test.sh $(top_builddir)
echo "Test combi"
$(top_srcdir)/test/run_test.sh 214 $(top_srcdir)/test/run_combi_test.sh $(top_builddir)
echo "Test dmenu regex"
$(top_srcdir)/test/run_test.sh 215 $(top_srcdir)/test/run_regex_test.sh $(top_builddir)
echo "Test dmenu glob"
$(top_srcdir)/test/run_test.sh 216 $(top_srcdir)/test/run_glob_test.sh $(top_builddir)
echo "End tests"

26
test/run_glob_test.sh Executable file
View File

@ -0,0 +1,26 @@
#!/usr/bin/env bash
echo -en "nooty\naap\nnoot\nmies" | rofi -glob -dmenu > output.txt &
RPID=$!
# send enter.
sleep 5;
xdotool key 'n'
sleep 0.4
xdotool key Shift+'8'
sleep 0.4
xdotool key 't'
sleep 0.4
xdotool key Return
# Get result, kill xvfb
wait ${RPID}
RETV=$?
OUTPUT=$(cat output.txt)
if [ "${OUTPUT}" != 'nooty' ]
then
echo "Got: '${OUTPUT}' expected 'nooty'"
exit 1
fi
exit ${RETV}

32
test/run_regex_test.sh Executable file
View File

@ -0,0 +1,32 @@
#!/usr/bin/env bash
echo -en "nooty\naap\nnoot\nmies" | rofi -regex -dmenu > output.txt &
RPID=$!
# send enter.
sleep 5;
xdotool key Shift+'6'
sleep 0.4
xdotool key 'n'
sleep 0.4
xdotool key 'o'
sleep 0.4
xdotool key 'o'
sleep 0.4
xdotool key 't'
sleep 0.4
xdotool key Shift+'4'
sleep 0.4
xdotool key Return
# Get result, kill xvfb
wait ${RPID}
RETV=$?
OUTPUT=$(cat output.txt)
if [ "${OUTPUT}" != 'noot' ]
then
echo "Got: '${OUTPUT}' expected 'noot'"
exit 1
fi
exit ${RETV}