[PATCH 3/5] test: wrap and indent test_emacs calls
Most test_emacs calls have long arguments that consist of many expressions. Putting them on a single line makes it hard to read and produces poor diff when they are changed. The patch puts every expression in test_emacs calls on a separate line. --- test/emacs | 124 -- test/test-lib.sh | 14 ++- 2 files changed, 114 insertions(+), 24 deletions(-) diff --git a/test/emacs b/test/emacs index 6f82b08..1e46c0d 100755 --- a/test/emacs +++ b/test/emacs @@ -7,32 +7,51 @@ EXPECTED=../emacs.expected-output add_email_corpus test_begin_subtest "Basic notmuch-hello view in emacs" -test_emacs '(notmuch-hello) (princ (buffer-string))' >OUTPUT +test_emacs '(notmuch-hello) + (princ (buffer-string))' >OUTPUT test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello test_begin_subtest "Saved search with 0 results" -test_emacs '(setq notmuch-show-empty-saved-searches t) (setq notmuch-saved-searches '\''(("inbox" . "tag:inbox") ("unread" . "tag:unread") ("empty" . "tag:doesnotexist"))) (notmuch-hello) (princ (buffer-string))' >OUTPUT +test_emacs '(setq notmuch-show-empty-saved-searches t) + (setq notmuch-saved-searches + '\''(("inbox" . "tag:inbox") + ("unread" . "tag:unread") + ("empty" . "tag:doesnotexist"))) + (notmuch-hello) + (princ (buffer-string))' >OUTPUT test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-with-empty test_begin_subtest "No saved searches displayed (all with 0 results)" -test_emacs '(setq notmuch-saved-searches '\''(("empty" . "tag:doesnotexist"))) (notmuch-hello) (princ (buffer-string))' >OUTPUT +test_emacs '(setq notmuch-saved-searches + '\''(("empty" . "tag:doesnotexist"))) + (notmuch-hello) + (princ (buffer-string))' >OUTPUT test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-no-saved-searches test_begin_subtest "Basic notmuch-search view in emacs" -test_emacs '(notmuch-search "tag:inbox") (notmuch-test-wait) (princ (buffer-string))' >OUTPUT +test_emacs '(notmuch-search "tag:inbox") + (notmuch-test-wait) + (princ (buffer-string))' >OUTPUT test_expect_equal_file OUTPUT $EXPECTED/notmuch-search-tag-inbox test_begin_subtest "Navigation of notmuch-hello to search results" -test_emacs '(notmuch-hello) (goto-char (point-min)) (re-search-forward "inbox") (widget-button-press (point)) (notmuch-test-wait) (princ (buffer-string))' >OUTPUT +test_emacs '(notmuch-hello) + (goto-char (point-min)) + (re-search-forward "inbox") + (widget-button-press (point)) + (notmuch-test-wait) + (princ (buffer-string))' >OUTPUT test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-view-inbox test_begin_subtest "Basic notmuch-show view in emacs" maildir_storage_thread=$(notmuch search --output=threads id:20091117190054.GU3165 at dottiness.seas.harvard.edu) -test_emacs "(notmuch-show \"$maildir_storage_thread\") (princ (buffer-string))" >OUTPUT +test_emacs "(notmuch-show \"$maildir_storage_thread\") + (princ (buffer-string))" >OUTPUT test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-maildir-storage test_begin_subtest "notmuch-show for message with invalid From" -add_message "[subject]=\"message-with-invalid-from\"" "[from]=\"\\\"Invalid \\\" From\\\" \"" +add_message "[subject]=\"message-with-invalid-from\"" \ + "[from]=\"\\\"Invalid \\\" From\\\" \"" thread=$(notmuch search --output=threads subject:message-with-invalid-from) output=$(test_emacs "(notmuch-show \"$thread\") (princ (buffer-string))") test_expect_equal "$output" \ @@ -44,33 +63,54 @@ Date: Tue, 05 Jan 2001 15:43:57 - This is just a test message (#1)' test_begin_subtest "Navigation of notmuch-search to thread view" -test_emacs '(notmuch-search "tag:inbox") (notmuch-test-wait) (goto-char (point-min)) (re-search-forward "Working with Maildir") (notmuch-search-show-thread) (notmuch-test-wait) (princ (buffer-string))' >OUTPUT +test_emacs '(notmuch-search "tag:inbox") + (notmuch-test-wait) + (goto-char (point-min)) + (re-search-forward "Working with Maildir") + (notmuch-search-show-thread) + (notmuch-test-wait) + (princ (buffer-string))' >OUTPUT test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-maildir-storage test_begin_subtest "Add tag from search view" os_x_darwin_thread=$(notmuch search --output=threads id:ddd65cda0911171950o4eea4389v86de9525e46052d3 at mail.gmail.com) -test_emacs "(notmuch-search \"$os_x_darwin_thread\") (notmuch-test-wait) (notmuch-search-add-tag \"tag-from-search-view\")" +test_emacs "(notmuch-search \"$os_x_darwin_thread\") + (notmuch-test-wait) + (notmuch-search-add-tag \"tag-from-search-view\")" output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize) test_expect_equal "$output" "thread:XXX
[PATCH 3/5] test: wrap and indent test_emacs calls
Most test_emacs calls have long arguments that consist of many expressions. Putting them on a single line makes it hard to read and produces poor diff when they are changed. The patch puts every expression in test_emacs calls on a separate line. --- test/emacs | 124 -- test/test-lib.sh | 14 ++- 2 files changed, 114 insertions(+), 24 deletions(-) diff --git a/test/emacs b/test/emacs index 6f82b08..1e46c0d 100755 --- a/test/emacs +++ b/test/emacs @@ -7,32 +7,51 @@ EXPECTED=../emacs.expected-output add_email_corpus test_begin_subtest "Basic notmuch-hello view in emacs" -test_emacs '(notmuch-hello) (princ (buffer-string))' >OUTPUT +test_emacs '(notmuch-hello) + (princ (buffer-string))' >OUTPUT test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello test_begin_subtest "Saved search with 0 results" -test_emacs '(setq notmuch-show-empty-saved-searches t) (setq notmuch-saved-searches '\''(("inbox" . "tag:inbox") ("unread" . "tag:unread") ("empty" . "tag:doesnotexist"))) (notmuch-hello) (princ (buffer-string))' >OUTPUT +test_emacs '(setq notmuch-show-empty-saved-searches t) + (setq notmuch-saved-searches + '\''(("inbox" . "tag:inbox") + ("unread" . "tag:unread") + ("empty" . "tag:doesnotexist"))) + (notmuch-hello) + (princ (buffer-string))' >OUTPUT test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-with-empty test_begin_subtest "No saved searches displayed (all with 0 results)" -test_emacs '(setq notmuch-saved-searches '\''(("empty" . "tag:doesnotexist"))) (notmuch-hello) (princ (buffer-string))' >OUTPUT +test_emacs '(setq notmuch-saved-searches + '\''(("empty" . "tag:doesnotexist"))) + (notmuch-hello) + (princ (buffer-string))' >OUTPUT test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-no-saved-searches test_begin_subtest "Basic notmuch-search view in emacs" -test_emacs '(notmuch-search "tag:inbox") (notmuch-test-wait) (princ (buffer-string))' >OUTPUT +test_emacs '(notmuch-search "tag:inbox") + (notmuch-test-wait) + (princ (buffer-string))' >OUTPUT test_expect_equal_file OUTPUT $EXPECTED/notmuch-search-tag-inbox test_begin_subtest "Navigation of notmuch-hello to search results" -test_emacs '(notmuch-hello) (goto-char (point-min)) (re-search-forward "inbox") (widget-button-press (point)) (notmuch-test-wait) (princ (buffer-string))' >OUTPUT +test_emacs '(notmuch-hello) + (goto-char (point-min)) + (re-search-forward "inbox") + (widget-button-press (point)) + (notmuch-test-wait) + (princ (buffer-string))' >OUTPUT test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-view-inbox test_begin_subtest "Basic notmuch-show view in emacs" maildir_storage_thread=$(notmuch search --output=threads id:20091117190054.gu3...@dottiness.seas.harvard.edu) -test_emacs "(notmuch-show \"$maildir_storage_thread\") (princ (buffer-string))" >OUTPUT +test_emacs "(notmuch-show \"$maildir_storage_thread\") + (princ (buffer-string))" >OUTPUT test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-maildir-storage test_begin_subtest "notmuch-show for message with invalid From" -add_message "[subject]=\"message-with-invalid-from\"" "[from]=\"\\\"Invalid \\\" From\\\" \"" +add_message "[subject]=\"message-with-invalid-from\"" \ + "[from]=\"\\\"Invalid \\\" From\\\" \"" thread=$(notmuch search --output=threads subject:message-with-invalid-from) output=$(test_emacs "(notmuch-show \"$thread\") (princ (buffer-string))") test_expect_equal "$output" \ @@ -44,33 +63,54 @@ Date: Tue, 05 Jan 2001 15:43:57 - This is just a test message (#1)' test_begin_subtest "Navigation of notmuch-search to thread view" -test_emacs '(notmuch-search "tag:inbox") (notmuch-test-wait) (goto-char (point-min)) (re-search-forward "Working with Maildir") (notmuch-search-show-thread) (notmuch-test-wait) (princ (buffer-string))' >OUTPUT +test_emacs '(notmuch-search "tag:inbox") + (notmuch-test-wait) + (goto-char (point-min)) + (re-search-forward "Working with Maildir") + (notmuch-search-show-thread) + (notmuch-test-wait) + (princ (buffer-string))' >OUTPUT test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-maildir-storage test_begin_subtest "Add tag from search view" os_x_darwin_thread=$(notmuch search --output=threads id:ddd65cda0911171950o4eea4389v86de9525e4605...@mail.gmail.com) -test_emacs "(notmuch-search \"$os_x_darwin_thread\") (notmuch-test-wait) (notmuch-search-add-tag \"tag-from-search-view\")" +test_emacs "(notmuch-search \"$os_x_darwin_thread\") + (notmuch-test-wait) + (notmuch-search-add-tag \"tag-from-search-view\")" output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize) test_expect_equal "$output" "thread:XXX