summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rwxr-xr-xtests/formats.sh2
-rw-r--r--tests/local.mk1
-rwxr-xr-xtests/parse.sh34
3 files changed, 21 insertions, 16 deletions
diff --git a/tests/formats.sh b/tests/formats.sh
index a0c4188..576b96a 100755
--- a/tests/formats.sh
+++ b/tests/formats.sh
@@ -24,7 +24,7 @@ set -eu
plan_ 1
exp="$(cat "${0%.sh}.exp")"
-got="$("${TOP_BUILDDIR}/@" -d '1970-01-02 03:04:05' -F)"
+got="$("${TOP_BUILDDIR}/atsign" -d '1970-01-02 03:04:05' -F)"
if [ x"${got}" = x"${exp}" ]; then
ok_ -- 'formats list'
diff --git a/tests/local.mk b/tests/local.mk
index 9124d94..84eb79e 100644
--- a/tests/local.mk
+++ b/tests/local.mk
@@ -16,5 +16,6 @@ SH_LOG_DRIVER = \
EXTRA_DIST += \
$(tests) \
%reldir%/disabled.sh \
+ %reldir%/formats.exp \
$(top_srcdir)/build-aux/tap-driver.sh \
%reldir%/aux/tap-functions.sh
diff --git a/tests/parse.sh b/tests/parse.sh
index 1150f28..eadd2cf 100755
--- a/tests/parse.sh
+++ b/tests/parse.sh
@@ -21,7 +21,10 @@ set -eu
. "${TOP_SRCDIR}/tests/aux/tap-functions.sh"
-fmts="$(TZ=UTC0 "${TOP_BUILDDIR}/@" -d '1970-01-01 00:00:00' -F)"
+now='1969-12-31 23:59:30'
+tgt='1970-01-01 00:00:00'
+
+fmts="$(TZ=UTC0 "${TOP_BUILDDIR}/atsign" -d "${tgt}" -F)"
time_fmts="$(printf '%s\n' "${fmts}" | \
sed -n '/^Time formats:$/,/^Date formats:$/s/^ \* //p')"
date_fmts="$(printf '%s\n' "${fmts}" | \
@@ -44,30 +47,31 @@ for fmt in $(printf '%s\n' "${fmts}"); do
diag_ "${fmt}"
done
-run_test()
+test_fmt()
{
- datetime="${1}"
- shift 1
+ now="${1}"
+ tgt="${2}"
+ fmt="${3}"
+ shift 3
- got="$(TZ=UTC0 "${TOP_BUILDDIR}/@" -d '1969-12-31 23:59:30' \
- "${datetime}" 2>&1)" || :
- if [ x"${got}" = x'0' ]; then
- ok_ -- "${datetime}"
+ got="$(TZ=UTC0 "${TOP_BUILDDIR}/atsign" -d "${now}" "${fmt}" 2>&1)" || :
+ if [ x"${got}" = x"${tgt}" ]; then
+ ok_ -- "${fmt}"
else
- not_ok_ -- "${datetime}"
- diag_ " Failed test '${datetime}'"
+ not_ok_ -- "${fmt}"
+ diag_ " Failed test '${fmt}'"
diag_ " got: '${got}'"
- diag_ " expected: '0'"
+ diag_ " expected: '${tgt}'"
fi
}
for time_fmt in ${time_fmts}; do
- run_test "${time_fmt}"
+ test_fmt "${now}" "${tgt}" "${time_fmt}"
for date_fmt in ${date_fmts}; do
- run_test "${date_fmt} ${time_fmt}"
- run_test "${time_fmt} ${date_fmt}"
+ test_fmt "${now}" "${tgt}" "${date_fmt} ${time_fmt}"
+ test_fmt "${now}" "${tgt}" "${time_fmt} ${date_fmt}"
done
done
for misc_fmt in ${misc_fmts}; do
- run_test "${misc_fmt}"
+ test_fmt "${now}" "${tgt}" "${misc_fmt}"
done