diff options
| author | David Bremner <david@tethera.net> | 2022-05-23 20:38:55 -0300 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2022-06-25 12:55:02 -0300 |
| commit | f48d2e2ff89a7e0a413b29ca844b2c785063eb3d (patch) | |
| tree | 3b29fe413f5b9d7928aac45f938da16f36eea5c1 /test | |
| parent | 2707c06a0fc587a68096a3ec6f054ba4f0d7e7c7 (diff) | |
lib/message: catch exceptions in _n_m_add_term
Some code movement is needed to make sure the cache is only
invalidated when the Xapian operation succeeds.
Diffstat (limited to 'test')
| -rwxr-xr-x | test/T566-lib-message.sh | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/T566-lib-message.sh b/test/T566-lib-message.sh index b6a9e536..bc9bfcb6 100755 --- a/test/T566-lib-message.sh +++ b/test/T566-lib-message.sh @@ -307,6 +307,23 @@ cat <<EOF > EXPECTED EOF test_expect_equal_file EXPECTED OUTPUT +test_begin_subtest "_notmuch_message_add_term catches exceptions" +cat c_head0 - c_tail <<'EOF' | test_private_C ${MAIL_DIR} + { + notmuch_private_status_t status; + /* This relies on Xapian throwing an exception for adding empty terms */ + status = _notmuch_message_add_term (message, "body", ""); + printf("%d\n%d\n", message != NULL, status != NOTMUCH_STATUS_SUCCESS ); + } +EOF +cat <<EOF > EXPECTED +== stdout == +1 +1 +== stderr == +EOF +test_expect_equal_file EXPECTED OUTPUT + test_begin_subtest "Handle removing all tags with closed db" cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} { |
