test/: Use faketime -f

Use the advanced timestamp specification format for libfaketime.

Before using that, some tests failed on 32-bit systems due to integer
overflows. It seems like faketime translates absolute dates to relative
dates by default. Moreover, libfaketime is not able to handle relative
dates that exceed the maximum value of a signed integer. Using "-f"
skips the conversion to relative dates.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
Lukas Fleischer 2012-12-22 00:49:29 +01:00
parent c054182890
commit 2ea91e1a8a
7 changed files with 11 additions and 7 deletions

View File

@ -6,7 +6,7 @@ if [ ! -x "$(command -v faketime)" ]; then
fi fi
if [ "$1" = 'actual' ]; then if [ "$1" = 'actual' ]; then
faketime '2011-02-25 23:42' "$CALCURSE" --read-only -D "$DATA_DIR" -a faketime -f '2011-02-25 23:42:00' "$CALCURSE" --read-only -D "$DATA_DIR" -a
elif [ "$1" = 'expected' ]; then elif [ "$1" = 'expected' ]; then
cat <<EOD cat <<EOD
02/25/11: 02/25/11:

View File

@ -6,7 +6,8 @@ if [ ! -x "$(command -v faketime)" ]; then
fi fi
if [ "$1" = 'actual' ]; then if [ "$1" = 'actual' ]; then
faketime '1912-06-23' "$CALCURSE" --read-only -D "$DATA_DIR"/ -d42 faketime -f '1912-06-23 00:00:00' "$CALCURSE" --read-only -D "$DATA_DIR"/ \
-d42
elif [ "$1" = 'expected' ]; then elif [ "$1" = 'expected' ]; then
cat <<EOD cat <<EOD
06/24/12: 06/24/12:

View File

@ -6,7 +6,8 @@ if [ ! -x "$(command -v faketime)" ]; then
fi fi
if [ "$1" = 'actual' ]; then if [ "$1" = 'actual' ]; then
faketime '1912-06-23' "$CALCURSE" --read-only -D "$DATA_DIR"/ -d42 faketime -f '1912-06-23 00:00:00' "$CALCURSE" --read-only -D "$DATA_DIR"/ \
-d42
elif [ "$1" = 'expected' ]; then elif [ "$1" = 'expected' ]; then
"$CALCURSE" --read-only -D "$DATA_DIR"/ -s06/23/1912 -r42 "$CALCURSE" --read-only -D "$DATA_DIR"/ -s06/23/1912 -r42
else else

View File

@ -6,7 +6,7 @@ if [ ! -x "$(command -v faketime)" ]; then
fi fi
if [ "$1" = 'actual' ]; then if [ "$1" = 'actual' ]; then
faketime '1912-07-10 04:10' "$CALCURSE" --read-only -D "$DATA_DIR" -n faketime -f '1912-07-10 04:10:00' "$CALCURSE" --read-only -D "$DATA_DIR" -n
elif [ "$1" = 'expected' ]; then elif [ "$1" = 'expected' ]; then
cat <<EOD cat <<EOD
next appointment: next appointment:

View File

@ -6,7 +6,7 @@ if [ ! -x "$(command -v faketime)" ]; then
fi fi
if [ "$1" = 'actual' ]; then if [ "$1" = 'actual' ]; then
faketime '2011-02-25 00:00:00' "$CALCURSE" --read-only -D "$DATA_DIR"/ -r faketime -f '2011-02-25 00:00:00' "$CALCURSE" --read-only -D "$DATA_DIR"/ -r
elif [ "$1" = 'expected' ]; then elif [ "$1" = 'expected' ]; then
cat <<EOD cat <<EOD
02/25/11: 02/25/11:

View File

@ -6,7 +6,8 @@ if [ ! -x "$(command -v faketime)" ]; then
fi fi
if [ "$1" = 'actual' ]; then if [ "$1" = 'actual' ]; then
faketime '2000-01-01 00:00:00' "$CALCURSE" --read-only -D "$DATA_DIR"/ -r400 faketime -f '2000-01-01 00:00:00' "$CALCURSE" --read-only -D "$DATA_DIR"/ \
-r400
elif [ "$1" = 'expected' ]; then elif [ "$1" = 'expected' ]; then
cat <<EOD cat <<EOD
04/07/00: 04/07/00:

View File

@ -6,7 +6,8 @@ if [ ! -x "$(command -v faketime)" ]; then
fi fi
if [ "$1" = 'actual' ]; then if [ "$1" = 'actual' ]; then
faketime '2000-01-01 00:00:00' "$CALCURSE" --read-only -D "$DATA_DIR"/ -r400 faketime -f '2000-01-01 00:00:00' "$CALCURSE" --read-only -D "$DATA_DIR"/ \
-r400
elif [ "$1" = 'expected' ]; then elif [ "$1" = 'expected' ]; then
"$CALCURSE" --read-only -D "$DATA_DIR"/ -s01/01/2000 -r400 "$CALCURSE" --read-only -D "$DATA_DIR"/ -s01/01/2000 -r400
else else