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.
master
Raymond E. Pasco 5 years ago committed by Drew DeVault
parent 8dfd30c96c
commit 2901e79edb
  1. 10
      test/preamble

@ -41,31 +41,31 @@ end 0
unset SOURCE_DATE_EPOCH unset SOURCE_DATE_EPOCH
begin "Writes the appropriate header" 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) test(8)
EOF EOF
end 0 end 0
begin "Preserves dashes" 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) test-manual(8)
EOF EOF
end 0 end 0
begin "Handles extra footer field" 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" test-manual(8) "Footer"
EOF EOF
end 0 end 0
begin "Handles both extra fields" 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" test-manual(8) "Footer" "Header"
EOF EOF
end 0 end 0
begin "Emits empty footer correctly" 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" test-manual(8) "" "Header"
EOF EOF
end 0 end 0

Loading…
Cancel
Save