Liam Hupfer <l...@hpfr.net> writes:

> It seems Emacs 30 has introduced additional wrapping when printing
> sexps. The NEWS section on pp seems relevant, particularly
> ‘pp-default-function’ defaulting to ‘pp-fill’. Maybe setting it to
> ‘ignore’ will clear things up.
>

Alternatively one can check the Emacs major version and conditionally
compare the outputs.  I have attached two patches as a proof of concept.
Tested with Emacs 30.1 and notmuch 0.39~rc0 on Debian Trixie.

> [...]

-- 
Regards,
Xiyue Deng
From 904fbec31b5fc0cf3edf73e5fa34e1f14bb03531 Mon Sep 17 00:00:00 2001
From: Xiyue Deng <manp...@gmail.com>
Date: Mon, 24 Feb 2025 22:24:24 -0800
Subject: [PATCH 1/2] test/vars: add TEST_EMACS_MAJOR_VERSION

This helps conditionally compare test outputs based on Emacs major
version.
---
 test/test-vars.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/test/test-vars.sh b/test/test-vars.sh
index 02d60f89..60569bbc 100644
--- a/test/test-vars.sh
+++ b/test/test-vars.sh
@@ -29,6 +29,7 @@ if [[ ( -n "$TEST_EMACS" && -z "$TEST_EMACSCLIENT" ) || \
 fi
 TEST_EMACS=${TEST_EMACS:-${EMACS:-emacs}}
 TEST_EMACSCLIENT=${TEST_EMACSCLIENT:-emacsclient}
+TEST_EMACS_MAJOR_VERSION=${TEST_EMACS_MAJOR_VERSION:-$(${TEST_EMACS} -Q --batch --eval '(prin1 emacs-major-version)')}
 TEST_GDB=${TEST_GDB:-gdb}
 TEST_CC=${TEST_CC:-cc}
 TEST_CFLAGS=${TEST_CFLAGS:-"-g -O0"}
-- 
2.47.2

From f7b0c37809d39f72ed09713a5e90c36b02f57e27 Mon Sep 17 00:00:00 2001
From: Xiyue Deng <manp...@gmail.com>
Date: Mon, 24 Feb 2025 22:26:06 -0800
Subject: [PATCH 2/2] test/emacs{,-tagging}: update test outputs based on Emacs
 major version

Emacs 30+ changed the outputs of some tests.  This patch changes the
expected outputs based on Emacs major version.
---
 test/T310-emacs.sh         |  9 ++++++++-
 test/T315-emacs-tagging.sh | 20 ++++++++++++++++++--
 2 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/test/T310-emacs.sh b/test/T310-emacs.sh
index e96c1601..071e74e8 100755
--- a/test/T310-emacs.sh
+++ b/test/T310-emacs.sh
@@ -1075,7 +1075,14 @@ output=$(test_emacs "(mapcar 'notmuch-escape-boolean-term (list
 	\"\\\"abc\"
 	\"\x01xyz\"
 	\"\\x201cxyz\\x201d\"))")
-test_expect_equal "$output" '("\"\"" "abc`~!@#$%^&*-=_+123" "\"(abc\"" "\")abc\"" "\"\"\"abc\"" "\"'$'\x01''xyz\"" "\"“xyz”\"")'
+if [ "${TEST_EMACS_MAJOR_VERSION}" -lt "30" ]; then
+    test_expect_equal "$output" \
+'("\"\"" "abc`~!@#$%^&*-=_+123" "\"(abc\"" "\")abc\"" "\"\"\"abc\"" "\"'$'\x01''xyz\"" "\"“xyz”\"")'
+else
+    test_expect_equal "$output" \
+'("\"\"" "abc`~!@#$%^&*-=_+123" "\"(abc\"" "\")abc\"" "\"\"\"abc\""
+ "\"'$'\x01''xyz\"" "\"“xyz”\"")'
+fi
 
 test_begin_subtest "Sending a message calls the send message hooks"
 emacs_deliver_message \
diff --git a/test/T315-emacs-tagging.sh b/test/T315-emacs-tagging.sh
index c26413ce..885d620f 100755
--- a/test/T315-emacs-tagging.sh
+++ b/test/T315-emacs-tagging.sh
@@ -63,9 +63,17 @@ output=$(test_emacs '(let ((notmuch-test-tag-hook-output nil)
 	       (execute-kbd-macro "+activate-hook\n")
 	       (execute-kbd-macro "-activate-hook\n")
 	       notmuch-test-tag-hook-output)')
-test_expect_equal "$output" \
+if [ "${TEST_EMAC_MAJOR_VERSION}" -lt "30" ]; then
+    test_expect_equal "$output" \
 '(("id:ddd65cda0911171950o4eea4389v86de9525e4605...@mail.gmail.com" "-activate-hook")
  ("id:ddd65cda0911171950o4eea4389v86de9525e4605...@mail.gmail.com" "+activate-hook"))'
+else
+    test_expect_equal "$output" \
+'(("id:ddd65cda0911171950o4eea4389v86de9525e4605...@mail.gmail.com"
+  "-activate-hook")
+ ("id:ddd65cda0911171950o4eea4389v86de9525e4605...@mail.gmail.com"
+  "+activate-hook"))'
+fi
 
 test_begin_subtest "notmuch-show: after-tag-hook is run, variables are defined"
 output=$(test_emacs '(let ((notmuch-test-tag-hook-output nil)
@@ -74,9 +82,17 @@ output=$(test_emacs '(let ((notmuch-test-tag-hook-output nil)
 	       (execute-kbd-macro "+activate-hook\n")
 	       (execute-kbd-macro "-activate-hook\n")
 	       notmuch-test-tag-hook-output)')
-test_expect_equal "$output" \
+if [ "${TEST_EMACS_MAJOR_VERSION}" -lt "30" ]; then
+    test_expect_equal "$output" \
 '(("id:ddd65cda0911171950o4eea4389v86de9525e4605...@mail.gmail.com" "-activate-hook")
  ("id:ddd65cda0911171950o4eea4389v86de9525e4605...@mail.gmail.com" "+activate-hook"))'
+else
+    test_expect_equal "$output" \
+'(("id:ddd65cda0911171950o4eea4389v86de9525e4605...@mail.gmail.com"
+  "-activate-hook")
+ ("id:ddd65cda0911171950o4eea4389v86de9525e4605...@mail.gmail.com"
+  "+activate-hook"))'
+fi
 
 
 test_begin_subtest "Search thread tag operations are race-free"
-- 
2.47.2

Attachment: signature.asc
Description: PGP signature

_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org

Reply via email to