unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org
Subject: [PATCH 2/6] test/emacs: add tests for hl-line-mode integration
Date: Sat, 10 Aug 2024 14:36:21 -0300	[thread overview]
Message-ID: <20240810174121.425192-3-david@tethera.net> (raw)
In-Reply-To: <20240810174121.425192-1-david@tethera.net>

Most of the known broken tests replicate (my intepretation of) the bug
reported at id:87fsfuuxwn.fsf@thinkbox (or some unreported, but
probably related bugs in tree/unthreaded view). The last 3 broken
tests are just unimplimented planned functionality.
---
 test/T312-emacs-hl-line.sh | 170 +++++++++++++++++++++++++++++++++++++
 1 file changed, 170 insertions(+)
 create mode 100755 test/T312-emacs-hl-line.sh

diff --git a/test/T312-emacs-hl-line.sh b/test/T312-emacs-hl-line.sh
new file mode 100755
index 00000000..4cceed30
--- /dev/null
+++ b/test/T312-emacs-hl-line.sh
@@ -0,0 +1,170 @@
+#!/usr/bin/env bash
+
+test_description="emacs hl-line-mode"
+. $(dirname "$0")/test-lib.sh || exit 1
+. $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1
+
+EXPECTED=$NOTMUCH_SRCDIR/test/emacs.expected-output
+
+test_require_emacs
+add_email_corpus
+
+test_begin_subtest "line 1, search"
+test_emacs_expect_t '(let ((notmuch-hl-line t))
+			(notmuch-search "tag:inbox")
+			(notmuch-test-wait)
+			(notmuch-test-expect-equal
+			 (let ((start (overlay-start hl-line-overlay))
+			       (end (overlay-end hl-line-overlay)))
+			   (list start (> end start)))
+			 (list 1 t)))'
+
+test_begin_subtest "line 1, tree"
+test_subtest_known_broken
+test_emacs_expect_t '(let ((notmuch-hl-line t))
+			(notmuch-tree "tag:inbox")
+			(notmuch-test-wait)
+			(notmuch-test-expect-equal
+			 (let ((start (overlay-start hl-line-overlay))
+			       (end (overlay-end hl-line-overlay)))
+			   (list start (> end start)))
+			 (list 1 t)))'
+
+test_begin_subtest "line 1, unthreaded"
+test_subtest_known_broken
+test_emacs_expect_t '(let ((notmuch-hl-line t))
+			(notmuch-tree "tag:inbox")
+			(notmuch-test-wait)
+			(notmuch-test-expect-equal
+			 (let ((start (overlay-start hl-line-overlay))
+			       (end (overlay-end hl-line-overlay)))
+			   (list start (> end start)))
+			 (list 1 t)))'
+
+test_begin_subtest "line 1, search, refresh"
+test_emacs_expect_t '(let ((notmuch-hl-line t))
+			(notmuch-search "tag:inbox")
+			(notmuch-test-wait)
+			(notmuch-refresh-this-buffer)
+			(notmuch-test-wait)
+			(notmuch-test-expect-equal (overlay-start hl-line-overlay) 1))'
+
+test_begin_subtest "line 1, tree, refresh"
+test_subtest_known_broken
+test_emacs_expect_t '(let ((notmuch-hl-line t))
+			(notmuch-tree "tag:inbox")
+			(notmuch-test-wait)
+			(notmuch-refresh-this-buffer)
+			(notmuch-test-wait)
+			(notmuch-test-expect-equal
+			 (let ((start (overlay-start hl-line-overlay))
+			       (end (overlay-end hl-line-overlay)))
+			   (list start (> end start)))
+			 (list 1 t)))'
+
+test_begin_subtest "line 1, unthreaded, refresh"
+test_subtest_known_broken
+test_emacs_expect_t '(let ((notmuch-hl-line t))
+			(notmuch-tree "tag:inbox")
+			(notmuch-test-wait)
+			(notmuch-refresh-this-buffer)
+			(notmuch-test-wait)
+			(notmuch-test-expect-equal
+			 (let ((start (overlay-start hl-line-overlay))
+			       (end (overlay-end hl-line-overlay)))
+			   (list start (> end start)))
+			 (list 1 t)))'
+
+
+test_begin_subtest "line 12, notmuch-search"
+test_emacs_expect_t '(let ((notmuch-hl-line t))
+			(notmuch-search "tag:inbox")
+			(notmuch-test-wait)
+			(forward-line 11)
+			(notmuch-post-command)
+			(notmuch-test-expect-equal
+			   (line-number-at-pos (overlay-start hl-line-overlay)) 12))'
+
+test_begin_subtest "line 12, tree"
+test_emacs_expect_t '(let ((notmuch-hl-line t))
+			(notmuch-tree "tag:inbox")
+			(notmuch-test-wait)
+			(forward-line 11)
+			(notmuch-post-command)
+			(notmuch-test-expect-equal
+			   (line-number-at-pos (overlay-start hl-line-overlay)) 12))'
+
+test_begin_subtest "line 12, unthreaded"
+test_emacs_expect_t '(let ((notmuch-hl-line t))
+			(notmuch-unthreaded "tag:inbox")
+			(notmuch-test-wait)
+			(forward-line 11)
+			(notmuch-post-command)
+			(notmuch-test-expect-equal
+			   (line-number-at-pos (overlay-start hl-line-overlay)) 12))'
+
+test_begin_subtest "line 12, search, refresh"
+test_subtest_known_broken
+test_emacs_expect_t '(let ((notmuch-hl-line t))
+			(notmuch-search "tag:inbox")
+			(notmuch-test-wait)
+			(forward-line 11)
+			(notmuch-post-command)
+			(notmuch-refresh-this-buffer)
+			(notmuch-test-wait)
+			(notmuch-test-expect-equal
+			   (line-number-at-pos (overlay-start hl-line-overlay)) 12))'
+
+test_begin_subtest "line 12, tree, refresh"
+test_subtest_known_broken
+test_emacs_expect_t '(let ((notmuch-hl-line t))
+			(notmuch-tree "tag:inbox")
+			(notmuch-test-wait)
+			(forward-line 11)
+			(notmuch-post-command)
+			(notmuch-refresh-this-buffer)
+			(notmuch-test-wait)
+			(notmuch-test-expect-equal
+			   (line-number-at-pos (overlay-start hl-line-overlay)) 12))'
+
+test_begin_subtest "line 12, unthreaded, refresh"
+test_subtest_known_broken
+test_emacs_expect_t '(let ((notmuch-hl-line t))
+			(notmuch-tree "tag:inbox")
+			(notmuch-test-wait)
+			(forward-line 11)
+			(notmuch-post-command)
+			(notmuch-refresh-this-buffer)
+			(notmuch-test-wait)
+			(notmuch-test-expect-equal
+			   (line-number-at-pos (overlay-start hl-line-overlay)) 12))'
+
+test_begin_subtest "hl-line disabled, search"
+test_subtest_known_broken
+test_emacs_expect_t '(let ((notmuch-hl-line nil))
+			(notmuch-search "tag:inbox")
+			(notmuch-test-wait)
+			(notmuch-test-expect-equal
+			   (or hl-line-mode hl-line-overlay)
+			   nil))'
+
+test_begin_subtest "hl-line disabled, tree"
+test_subtest_known_broken
+test_emacs_expect_t '(let ((notmuch-hl-line nil))
+			(notmuch-tree "tag:inbox")
+			(notmuch-test-wait)
+			(notmuch-test-expect-equal
+			   (or hl-line-mode hl-line-overlay)
+			   nil))'
+
+test_begin_subtest "hl-line disabled, unthreaded"
+test_subtest_known_broken
+test_emacs_expect_t '(let ((notmuch-hl-line nil))
+			(notmuch-unthreaded "tag:inbox")
+			(notmuch-test-wait)
+			(notmuch-test-expect-equal
+			   (or hl-line-mode hl-line-overlay)
+			   nil))'
+
+test_done
+
-- 
2.43.0

  parent reply	other threads:[~2024-08-10 17:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-10 17:36 hl-line fixes David Bremner
2024-08-10 17:36 ` [PATCH 1/6] emacs: add defcustom to control hl-line mode David Bremner
2024-08-10 17:36 ` David Bremner [this message]
2024-08-10 17:36 ` [PATCH 3/6] emacs: replace use of hook to draw hl-line in search mode David Bremner
2024-08-10 17:36 ` [PATCH 4/6] emacs/tree: condition hl-line-mode on notmuch-hl-line David Bremner
2024-08-10 17:36 ` [PATCH 5/6] emacs/tree: call notmuch-hl-line-mode from tree-sentinel David Bremner
2024-08-10 17:36 ` [PATCH 6/6] emacs/tree: add call to notmuch-hl-line-mode from process-filter David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240810174121.425192-3-david@tethera.net \
    --to=david@tethera.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).