notmuch/test/T660-bad-date.sh
David Bremner 62822a4e2d lib: clamp return value of g_mime_utils_header_decode_date to >=0
For reasons not completely understood at this time, gmime (as of
2.6.22) is returning a date before 1900 on bad date input. Since this
confuses some other software, we clamp such dates to 0,
i.e. 1970-01-01.
2017-03-15 21:58:25 -03:00

14 lines
382 B
Bash
Executable file

#!/usr/bin/env bash
test_description="parsing of bad dates"
. ./test-lib.sh || exit 1
add_message [date]='"()"'
test_begin_subtest 'Bad dates translate to a date after the Unix epoch'
cat <<EOF >EXPECTED
thread:0000000000000001 1970-01-01 [1/1] Notmuch Test Suite; Test message #1 (inbox unread)
EOF
notmuch search '*' > OUTPUT
test_expect_equal_file EXPECTED OUTPUT
test_done