test/: Use correct calcurse binary and data dir
We really don't want to use the calcurse(1) binary from "$PATH" here. Introduce an environment variable "$CALCURSE" which can be used specify the binary to use and set this variable to the binary located in the build directory by default. Similarly, add another environment variable "$DATA_DIR" that can be used to specify a data directory. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
parent
423bfcc9ac
commit
f76e1cce40
@ -17,6 +17,10 @@ TESTS = \
|
||||
next-001.sh \
|
||||
search-001.sh
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
CALCURSE='$(top_builddir)/src/calcurse' \
|
||||
DATA_DIR='$(top_srcdir)/test/data/'
|
||||
|
||||
AM_CFLAGS = -std=c99 -pedantic -D_POSIX_C_SOURCE=200809L
|
||||
|
||||
check_PROGRAMS = run-test
|
||||
|
@ -6,7 +6,7 @@ if [ ! -x "$(command -v faketime)" ]; then
|
||||
fi
|
||||
|
||||
if [ "$1" = 'actual' ]; then
|
||||
faketime '2011-02-25 23:42' calcurse -D data -a
|
||||
faketime '2011-02-25 23:42' "$CALCURSE" -D "$DATA_DIR" -a
|
||||
elif [ "$1" = 'expected' ]; then
|
||||
cat <<EOD
|
||||
02/25/11:
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "$1" = 'actual' ]; then
|
||||
calcurse -D data/ -d02/25/2011
|
||||
"$CALCURSE" -D "$DATA_DIR"/ -d02/25/2011
|
||||
elif [ "$1" = 'expected' ]; then
|
||||
cat <<EOD
|
||||
02/25/11:
|
||||
|
@ -6,7 +6,7 @@ if [ ! -x "$(command -v faketime)" ]; then
|
||||
fi
|
||||
|
||||
if [ "$1" = 'actual' ]; then
|
||||
faketime '1912-06-23' calcurse -D data/ -d42
|
||||
faketime '1912-06-23' "$CALCURSE" -D "$DATA_DIR"/ -d42
|
||||
elif [ "$1" = 'expected' ]; then
|
||||
cat <<EOD
|
||||
06/24/12:
|
||||
|
@ -6,9 +6,9 @@ if [ ! -x "$(command -v faketime)" ]; then
|
||||
fi
|
||||
|
||||
if [ "$1" = 'actual' ]; then
|
||||
faketime '1912-06-23' calcurse -D data/ -d42
|
||||
faketime '1912-06-23' "$CALCURSE" -D "$DATA_DIR"/ -d42
|
||||
elif [ "$1" = 'expected' ]; then
|
||||
calcurse -D data/ -s06/23/1912 -r42
|
||||
"$CALCURSE" -D "$DATA_DIR"/ -s06/23/1912 -r42
|
||||
else
|
||||
./run-test "$0"
|
||||
fi
|
||||
|
@ -6,7 +6,7 @@ if [ ! -x "$(command -v faketime)" ]; then
|
||||
fi
|
||||
|
||||
if [ "$1" = 'actual' ]; then
|
||||
faketime '1912-07-10 04:10' calcurse -D data -n
|
||||
faketime '1912-07-10 04:10' "$CALCURSE" -D "$DATA_DIR" -n
|
||||
elif [ "$1" = 'expected' ]; then
|
||||
cat <<EOD
|
||||
next appointment:
|
||||
|
@ -6,7 +6,7 @@ if [ ! -x "$(command -v faketime)" ]; then
|
||||
fi
|
||||
|
||||
if [ "$1" = 'actual' ]; then
|
||||
faketime '2011-02-25 00:00:00' calcurse -D data/ -r
|
||||
faketime '2011-02-25 00:00:00' "$CALCURSE" -D "$DATA_DIR"/ -r
|
||||
elif [ "$1" = 'expected' ]; then
|
||||
cat <<EOD
|
||||
02/25/11:
|
||||
|
@ -6,7 +6,7 @@ if [ ! -x "$(command -v faketime)" ]; then
|
||||
fi
|
||||
|
||||
if [ "$1" = 'actual' ]; then
|
||||
faketime '2000-01-01 00:00:00' calcurse -D data/ -r400
|
||||
faketime '2000-01-01 00:00:00' "$CALCURSE" -D "$DATA_DIR"/ -r400
|
||||
elif [ "$1" = 'expected' ]; then
|
||||
cat <<EOD
|
||||
04/07/00:
|
||||
|
@ -6,9 +6,9 @@ if [ ! -x "$(command -v faketime)" ]; then
|
||||
fi
|
||||
|
||||
if [ "$1" = 'actual' ]; then
|
||||
faketime '2000-01-01 00:00:00' calcurse -D data/ -r400
|
||||
faketime '2000-01-01 00:00:00' "$CALCURSE" -D "$DATA_DIR"/ -r400
|
||||
elif [ "$1" = 'expected' ]; then
|
||||
calcurse -D data/ -s01/01/2000 -r400
|
||||
"$CALCURSE" -D "$DATA_DIR"/ -s01/01/2000 -r400
|
||||
else
|
||||
./run-test "$0"
|
||||
fi
|
||||
|
@ -6,7 +6,7 @@ if [ ! -x "$(command -v faketime)" ]; then
|
||||
fi
|
||||
|
||||
if [ "$1" = 'actual' ]; then
|
||||
calcurse -D data/ -s01/01/1902 -r36500 -S '^[KMS]an.*or'
|
||||
"$CALCURSE" -D "$DATA_DIR"/ -s01/01/1902 -r36500 -S '^[KMS]an.*or'
|
||||
elif [ "$1" = 'expected' ]; then
|
||||
cat <<EOD
|
||||
12/06/42:
|
||||
|
@ -1,11 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "$1" = 'actual' ]; then
|
||||
calcurse -D data/ -t | sort
|
||||
"$CALCURSE" -D "$DATA_DIR"/ -t | sort
|
||||
elif [ "$1" = 'expected' ]; then
|
||||
(
|
||||
echo 'to do:'
|
||||
sed '/^\[-/d; s/^\[\([0-9]\)\] \(.*\)/\1. \2/' data/todo
|
||||
sed '/^\[-/d; s/^\[\([0-9]\)\] \(.*\)/\1. \2/' "$DATA_DIR"/todo
|
||||
) | sort
|
||||
else
|
||||
./run-test "$0"
|
||||
|
@ -1,10 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "$1" = 'actual' ]; then
|
||||
calcurse -D data/ -t3
|
||||
"$CALCURSE" -D "$DATA_DIR"/ -t3
|
||||
elif [ "$1" = 'expected' ]; then
|
||||
echo 'to do:'
|
||||
sed -n 's/^\[3\] \(.*\)/3. \1/p' data/todo
|
||||
sed -n 's/^\[3\] \(.*\)/3. \1/p' "$DATA_DIR"/todo
|
||||
else
|
||||
./run-test "$0"
|
||||
fi
|
||||
|
@ -1,11 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "$1" = 'actual' ]; then
|
||||
calcurse -D data/ -t0 | sort -n
|
||||
"$CALCURSE" -D "$DATA_DIR"/ -t0 | sort -n
|
||||
elif [ "$1" = 'expected' ]; then
|
||||
(
|
||||
echo 'completed tasks:'
|
||||
sed -n 's/^\[-\([0-9]\)\] \(.*\)/\1. \2/p' data/todo
|
||||
sed -n 's/^\[-\([0-9]\)\] \(.*\)/\1. \2/p' "$DATA_DIR"/todo
|
||||
) | sort -n
|
||||
else
|
||||
./run-test "$0"
|
||||
|
Loading…
x
Reference in New Issue
Block a user