~sircmpwn/scdoc

2901e79edb82fcace0e52c9db6ee7aef9de7187f — Raymond E. Pasco a month ago 8dfd30c
Fix timezone-dependent tests

These tests fail depending on timezone and current time if the date
differs from the UTC date. This was remedied by using `date -u`, which
is POSIX.
1 files changed, 5 insertions(+), 5 deletions(-)

M test/preamble
M test/preamble => test/preamble +5 -5
@@ 41,31 41,31 @@ end 0
unset SOURCE_DATE_EPOCH

begin "Writes the appropriate header"
scdoc <<EOF | grep '^\.TH "test" "8" "'"$(date +'%F')"'"' >/dev/null
scdoc <<EOF | grep '^\.TH "test" "8" "'"$(date -u +'%F')"'"' >/dev/null
test(8)
EOF
end 0

begin "Preserves dashes"
scdoc <<EOF | grep '^\.TH "test-manual" "8" "'"$(date +'%F')"'"' >/dev/null
scdoc <<EOF | grep '^\.TH "test-manual" "8" "'"$(date -u +'%F')"'"' >/dev/null
test-manual(8)
EOF
end 0

begin "Handles extra footer field"
scdoc <<EOF | grep '^\.TH "test-manual" "8" "'"$(date +'%F')"'" "Footer"' >/dev/null
scdoc <<EOF | grep '^\.TH "test-manual" "8" "'"$(date -u +'%F')"'" "Footer"' >/dev/null
test-manual(8) "Footer"
EOF
end 0

begin "Handles both extra fields"
scdoc <<EOF | grep '^\.TH "test-manual" "8" "'"$(date +'%F')"'" "Footer" "Header"' >/dev/null
scdoc <<EOF | grep '^\.TH "test-manual" "8" "'"$(date -u +'%F')"'" "Footer" "Header"' >/dev/null
test-manual(8) "Footer" "Header"
EOF
end 0

begin "Emits empty footer correctly"
scdoc <<EOF | grep '^\.TH "test-manual" "8" "'"$(date +'%F')"'" "" "Header"' >/dev/null
scdoc <<EOF | grep '^\.TH "test-manual" "8" "'"$(date -u +'%F')"'" "" "Header"' >/dev/null
test-manual(8) "" "Header"
EOF
end 0