From 1cd56d4a0e3ad0d76e1a9171f9c6be615ef8a747 Mon Sep 17 00:00:00 2001
From: Kristoffer Balintona <krisbalintona@gmail.com>
Date: Mon, 4 Nov 2024 23:38:07 -0600
Subject: [PATCH 2/3] test/emacs: Add tests for `message-cite-reply-position'

`message-cite-reply-position' affects the position of the email body
and signature relative to the email citation in email replies.

Test each of the three possible values of
`message-cite-reply-position'. If `message-cite-reply-position' is
'traditional or 'below, place the email signature below the
citation. If `message-cite-reply-position' is 'above, place the email
signature above the citation (as in Gmail-style email replies).
---
 test/T453-emacs-reply.sh | 131 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 131 insertions(+)

diff --git a/test/T453-emacs-reply.sh b/test/T453-emacs-reply.sh
index 0a27d066..f02a2fb9 100755
--- a/test/T453-emacs-reply.sh
+++ b/test/T453-emacs-reply.sh
@@ -68,4 +68,135 @@ test_emacs "(notmuch-show \"id:${ID3}\")
 notmuch_dir_sanitize < OUTPUT.raw > OUTPUT
 test_expect_equal_file_nonempty $EXPECTED/notmuch-reply-duplicate-4 OUTPUT
 
+add_email_corpus default
+
+ID4=1258471718-6781-2-git-send-email-dottedmag@dottedmag.net
+test_begin_subtest "if message-cite-reply-position is 'above, position citation below signature"
+test_emacs "(let ((message-cite-reply-position 'above)
+             (message-signature \"EMAIL SIGNATURE\"))
+         (notmuch-mua-new-reply \"id:${ID4}\")
+         (test-visible-output \"OUTPUT.raw\"))"
+cat <<EOF > EXPECTED
+From: Notmuch Test Suite <test_suite@notmuchmail.org>
+To: Mikhail Gusarov <dottedmag@dottedmag.net>
+Subject: Re: [notmuch] [PATCH 2/2] Include <stdint.h> to get uint32_t in C++ file with gcc 4.4
+In-Reply-To: <1258471718-6781-2-git-send-email-dottedmag@dottedmag.net>
+Fcc: MAIL_DIR/sent
+--text follows this line--
+
+-- 
+EMAIL SIGNATURE
+
+"Mikhail Gusarov" <dottedmag@dottedmag.net> writes:
+
+> Signed-off-by: Mikhail Gusarov <dottedmag at dottedmag.net>
+> ---
+>  lib/message.cc |    2 ++
+>  1 files changed, 2 insertions(+), 0 deletions(-)
+>
+> diff --git a/lib/message.cc b/lib/message.cc
+> index 72c350f..a4b090b 100644
+> --- a/lib/message.cc
+> +++ b/lib/message.cc
+> @@ -21,6 +21,8 @@
+>  #include "notmuch-private.h"
+>  #include "database-private.h"
+>  
+> +#include <stdint.h>
+> +
+>  #include <gmime/gmime.h>
+>  
+>  #include <xapian.h>
+> -- 
+> 1.6.3.3
+EOF
+notmuch_dir_sanitize < OUTPUT.raw > OUTPUT
+test_expect_equal_file EXPECTED OUTPUT
+
+test_begin_subtest "if message-cite-reply-position is 'traditional, position citation above signature"
+test_emacs "(let ((message-cite-reply-position 'traditional)
+             (message-signature \"EMAIL SIGNATURE\"))
+         (notmuch-mua-new-reply \"id:${ID4}\")
+         (test-visible-output \"OUTPUT.raw\"))"
+cat <<EOF > EXPECTED
+From: Notmuch Test Suite <test_suite@notmuchmail.org>
+To: Mikhail Gusarov <dottedmag@dottedmag.net>
+Subject: Re: [notmuch] [PATCH 2/2] Include <stdint.h> to get uint32_t in C++ file with gcc 4.4
+In-Reply-To: <1258471718-6781-2-git-send-email-dottedmag@dottedmag.net>
+Fcc: MAIL_DIR/sent
+--text follows this line--
+"Mikhail Gusarov" <dottedmag@dottedmag.net> writes:
+
+> Signed-off-by: Mikhail Gusarov <dottedmag at dottedmag.net>
+> ---
+>  lib/message.cc |    2 ++
+>  1 files changed, 2 insertions(+), 0 deletions(-)
+>
+> diff --git a/lib/message.cc b/lib/message.cc
+> index 72c350f..a4b090b 100644
+> --- a/lib/message.cc
+> +++ b/lib/message.cc
+> @@ -21,6 +21,8 @@
+>  #include "notmuch-private.h"
+>  #include "database-private.h"
+>  
+> +#include <stdint.h>
+> +
+>  #include <gmime/gmime.h>
+>  
+>  #include <xapian.h>
+> -- 
+> 1.6.3.3
+>
+>
+
+-- 
+EMAIL SIGNATURE
+EOF
+notmuch_dir_sanitize < OUTPUT.raw > OUTPUT
+test_expect_equal_file EXPECTED OUTPUT
+
+test_begin_subtest "if message-cite-reply-position is 'below, position citation above signature"
+test_emacs "(let ((message-cite-reply-position 'below)
+             (message-signature \"EMAIL SIGNATURE\"))
+         (notmuch-mua-new-reply \"id:${ID4}\")
+         (test-visible-output \"OUTPUT.raw\"))"
+cat <<EOF > EXPECTED
+From: Notmuch Test Suite <test_suite@notmuchmail.org>
+To: Mikhail Gusarov <dottedmag@dottedmag.net>
+Subject: Re: [notmuch] [PATCH 2/2] Include <stdint.h> to get uint32_t in C++ file with gcc 4.4
+In-Reply-To: <1258471718-6781-2-git-send-email-dottedmag@dottedmag.net>
+Fcc: MAIL_DIR/sent
+--text follows this line--
+"Mikhail Gusarov" <dottedmag@dottedmag.net> writes:
+
+> Signed-off-by: Mikhail Gusarov <dottedmag at dottedmag.net>
+> ---
+>  lib/message.cc |    2 ++
+>  1 files changed, 2 insertions(+), 0 deletions(-)
+>
+> diff --git a/lib/message.cc b/lib/message.cc
+> index 72c350f..a4b090b 100644
+> --- a/lib/message.cc
+> +++ b/lib/message.cc
+> @@ -21,6 +21,8 @@
+>  #include "notmuch-private.h"
+>  #include "database-private.h"
+>  
+> +#include <stdint.h>
+> +
+>  #include <gmime/gmime.h>
+>  
+>  #include <xapian.h>
+> -- 
+> 1.6.3.3
+>
+>
+
+-- 
+EMAIL SIGNATURE
+EOF
+notmuch_dir_sanitize < OUTPUT.raw > OUTPUT
+test_expect_equal_file EXPECTED OUTPUT
+
 test_done
-- 
2.51.0

