test: Add emacs test for messages with very long subjects

Emacs search does not show messages with very long subjects. The
main notmuch view shows unread messages but nothing in the search
results. Thus you can not remove unread tag from the emacs
interface.

The test uses 4018 character long subject. This is the minimal
length to trigger the bug. I think the subject length should be
increased to a much higher value once the bug is fixed.

The test is currently failing.

The code is borrowed from the "Message with .. in Message-Id:"
test. Looks like this may be a common case for testing emacs
interface bugs with particular messages and should be moved to a
test-lib function.

Regards,
  Dmitry
commit f6892445d3212d49bcbfd2e50e6337c0a81eb26e
Author: Dmitry Kurochkin <[email protected]>
Date:   Sun Nov 21 07:10:15 2010 +0300

    test: Add emacs test for messages with very long subjects
    
    Emacs search does not show messages with very long subjects. The
    main notmuch view shows unread messages but nothing in the search
    results. Thus you can not remove unread tag from the emacs
    interface.
    
    The test uses 4018 character long subject. This is the minimal
    length to trigger the bug. I think the subject length should be
    increased to a much higher value once the bug is fixed.
    
    The test is currently failing.
    
    The code is borrowed from the "Message with .. in Message-Id:"
    test. Looks like this may be a common case for testing emacs
    interface bugs with particular messages and should be moved to a
    test-lib function.

diff --git a/test/emacs b/test/emacs
index 75dec89..52b7d0d 100755
--- a/test/emacs
+++ b/test/emacs
@@ -51,40 +51,47 @@ test_begin_subtest "Remove tag from search view"
 test_emacs "(notmuch-search \"$os_x_darwin_thread\") (notmuch-test-wait) (notmuch-search-remove-tag \"tag-from-search-view\")"
 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
 test_expect_equal "$output" "thread:XXX   2009-11-18 [4/4] Jjgod Jiang, Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox unread)"
 
 test_begin_subtest "Add tag from notmuch-show view"
 test_emacs "(notmuch-show \"$os_x_darwin_thread\") (notmuch-show-add-tag \"tag-from-show-view\")"
 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
 test_expect_equal "$output" "thread:XXX   2009-11-18 [4/4] Jjgod Jiang, Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox tag-from-show-view unread)"
 
 test_begin_subtest "Remove tag from notmuch-show view"
 test_emacs "(notmuch-show \"$os_x_darwin_thread\") (notmuch-show-remove-tag \"tag-from-show-view\")"
 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
 test_expect_equal "$output" "thread:XXX   2009-11-18 [4/4] Jjgod Jiang, Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox unread)"
 
 test_begin_subtest "Message with .. in Message-Id:"
 add_message [id]=123.....@example '[subject]="Message with .. in Message-Id"'
 test_emacs '(notmuch-search "id:\"123.....@example\"") (notmuch-test-wait) (notmuch-search-add-tag "search-add") (notmuch-search-add-tag "search-remove") (notmuch-search-remove-tag "search-remove") (notmuch-show "id:\"123.....@example\"") (notmuch-test-wait) (notmuch-show-add-tag "show-add") (notmuch-show-add-tag "show-remove") (notmuch-show-remove-tag "show-remove")'
 output=$(notmuch search 'id:"123.....@example"' | notmuch_search_sanitize)
 test_expect_equal "$output" "thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Message with .. in Message-Id (inbox search-add show-add)"
 
+test_begin_subtest "Message with 4018 character long Subject:"
+subject=`for i in \`seq 4018\`; do echo -n a; done`
+add_message [id]=subject_4...@example [subject]=$subject
+test_emacs '(notmuch-search "id:\"subject_4...@example\"") (notmuch-test-wait) (notmuch-search-add-tag "search-add") (notmuch-search-add-tag "search-remove") (notmuch-search-remove-tag "search-remove") (notmuch-show "id:\"subject_4...@example\"") (notmuch-test-wait) (notmuch-show-add-tag "show-add") (notmuch-show-add-tag "show-remove") (notmuch-show-remove-tag "show-remove")'
+output=$(notmuch search 'id:"subject_4...@example"' | notmuch_search_sanitize)
+test_expect_equal "$output" "thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; $subject (inbox search-add show-add)"
+
 test_begin_subtest "Sending a message via (fake) SMTP"
 
 # Before we can send a message, we have to prepare the FCC maildir
 mkdir -p mail/sent/cur
 mkdir -p mail/sent/new
 mkdir -p mail/sent/tmp
 
 ../smtp-dummy sent_message &
 smtp_dummy_pid=$!
 test_emacs "(setq message-send-mail-function 'message-smtpmail-send-it) (setq smtpmail-smtp-server \"localhost\") (setq smtpmail-smtp-service \"25025\") (notmuch-hello) (notmuch-mua-mail) (message-goto-to) (insert \"[email protected]\ndate: Fri, 29 Mar 1974 10:00:00 -0000\") (message-goto-subject) (insert \"Testing message sent via SMTP\") (message-goto-body) (insert \"This is a test that messages are sent via SMTP\") (message-send-and-exit)" >/dev/null 2>&1
 wait ${smtp_dummy_pid}
 
 output=$(sed \
     -e s',^User-Agent: Notmuch/.* Emacs/.*,User-Agent: Notmuch/XXX Emacs/XXX,' \
     -e s',^Message-ID: <.*>$,Message-ID: <XXX>,' < sent_message)
 test_expect_equal "$output" "From: Notmuch Test Suite <[email protected]>
 To: [email protected]
 Subject: Testing message sent via SMTP
 Date: Fri, 29 Mar 1974 10:00:00 -0000
 User-Agent: Notmuch/XXX Emacs/XXX
_______________________________________________
notmuch mailing list
[email protected]
http://notmuchmail.org/mailman/listinfo/notmuch

Reply via email to