summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2012-12-22 00:49:29 +0100
committerLukas Fleischer <calcurse@cryptocrack.de>2012-12-22 01:09:17 +0100
commit2ea91e1a8a2ee4318e3530ec2680565ad11b1585 (patch)
tree3ce57c3d13289ba7bc84efa1f79973beded78aa5
parentc054182890b5a2145d457d8ecade200d851e95fd (diff)
downloadcalcurse-2ea91e1a8a2ee4318e3530ec2680565ad11b1585.zip
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>
-rwxr-xr-xtest/appointment-001.sh2
-rwxr-xr-xtest/day-002.sh3
-rwxr-xr-xtest/day-003.sh3
-rwxr-xr-xtest/next-001.sh2
-rwxr-xr-xtest/range-001.sh2
-rwxr-xr-xtest/range-002.sh3
-rwxr-xr-xtest/range-003.sh3
7 files changed, 11 insertions, 7 deletions
diff --git a/test/appointment-001.sh b/test/appointment-001.sh
index ad811a3..c0f60c7 100755
--- a/test/appointment-001.sh
+++ b/test/appointment-001.sh
@@ -6,7 +6,7 @@ if [ ! -x "$(command -v faketime)" ]; then
fi
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
cat <<EOD
02/25/11:
diff --git a/test/day-002.sh b/test/day-002.sh
index 3f984c6..a9ac2c4 100755
--- a/test/day-002.sh
+++ b/test/day-002.sh
@@ -6,7 +6,8 @@ if [ ! -x "$(command -v faketime)" ]; then
fi
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
cat <<EOD
06/24/12:
diff --git a/test/day-003.sh b/test/day-003.sh
index baccc93..63df45a 100755
--- a/test/day-003.sh
+++ b/test/day-003.sh
@@ -6,7 +6,8 @@ if [ ! -x "$(command -v faketime)" ]; then
fi
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
"$CALCURSE" --read-only -D "$DATA_DIR"/ -s06/23/1912 -r42
else
diff --git a/test/next-001.sh b/test/next-001.sh
index 04b0bf2..98002ba 100755
--- a/test/next-001.sh
+++ b/test/next-001.sh
@@ -6,7 +6,7 @@ if [ ! -x "$(command -v faketime)" ]; then
fi
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
cat <<EOD
next appointment:
diff --git a/test/range-001.sh b/test/range-001.sh
index fa093d8..116b846 100755
--- a/test/range-001.sh
+++ b/test/range-001.sh
@@ -6,7 +6,7 @@ if [ ! -x "$(command -v faketime)" ]; then
fi
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
cat <<EOD
02/25/11:
diff --git a/test/range-002.sh b/test/range-002.sh
index 5c28eaf..55d057d 100755
--- a/test/range-002.sh
+++ b/test/range-002.sh
@@ -6,7 +6,8 @@ if [ ! -x "$(command -v faketime)" ]; then
fi
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
cat <<EOD
04/07/00:
diff --git a/test/range-003.sh b/test/range-003.sh
index cec7a43..027937f 100755
--- a/test/range-003.sh
+++ b/test/range-003.sh
@@ -6,7 +6,8 @@ if [ ! -x "$(command -v faketime)" ]; then
fi
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
"$CALCURSE" --read-only -D "$DATA_DIR"/ -s01/01/2000 -r400
else