emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/hyperbole f00bc2440d 10/28: Merge branch 'master' into


From: ELPA Syncer
Subject: [elpa] externals/hyperbole f00bc2440d 10/28: Merge branch 'master' into rsw
Date: Tue, 21 Nov 2023 12:58:16 -0500 (EST)

branch: externals/hyperbole
commit f00bc2440d43e9dbdbbfa5e90b2db5dd759a1402
Merge: cd451895ae cc887f9930
Author: bw <rsw@gnu.org>
Commit: bw <rsw@gnu.org>

    Merge branch 'master' into rsw
---
 ChangeLog               |  6 ++++
 test/kotl-mode-tests.el | 73 ++++++++++++++++++++++++++++++++++++++-----------
 2 files changed, 63 insertions(+), 16 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e162ebb149..b8eccd33e3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,12 @@
     rather than using its elisp backend.  Remove that code.
                 (tags-fix): Remove optional load of this very old file.
 
+2023-10-09  Mats Lidell  <matsl@gnu.org>
+
+* test/kotl-mode-tests.el (kotl-mode-kill-contents)
+    (kotl-mode-kill-contents-all): Add kotl-tests for cell contents
+    removal.
+
 2023-10-07  Mats Lidell  <matsl@gnu.org>
 
 * hsys-org-roam.el: Byte compile. Warning is handled by declaration.
diff --git a/test/kotl-mode-tests.el b/test/kotl-mode-tests.el
index beda417096..f102c40cc4 100644
--- a/test/kotl-mode-tests.el
+++ b/test/kotl-mode-tests.el
@@ -3,7 +3,7 @@
 ;; Author:       Mats Lidell <matsl@gnu.org>
 ;;
 ;; Orig-Date:    18-May-21 at 22:14:10
-;; Last-Mod:      5-Oct-23 at 21:15:10 by Mats Lidell
+;; Last-Mod:      9-Oct-23 at 00:51:28 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -347,6 +347,31 @@
           (should (string= (kcell-view:label (point)) "1a")))
       (hy-delete-file-and-buffer kotl-file))))
 
+(ert-deftest kotl-mode-kill-contents ()
+  "Kotl-mode kill contents shall remove rest of a cell."
+  (with-temp-buffer
+    (kotl-mode)
+    (insert "first line")
+    (kotl-mode:backward-word)
+    (should (looking-at-p "line"))
+    (kotl-mode:kill-contents nil)
+    (kotl-mode:beginning-of-cell)
+    (should (looking-at-p "first $"))))
+
+(ert-deftest kotl-mode-kill-contents-all ()
+  "Kotl-mode kill contents with prefix argument shall remove the cell."
+  (with-temp-buffer
+    (kotl-mode)
+    (insert "first line")
+    (kotl-mode:backward-word)
+    (should (looking-at-p "line"))
+    (let ((transient-mark-mode nil))
+      ;; kotl-mode:kill-contents uses kotl-mode:kill-region which
+      ;; depends on transient-mark-mode
+      (kotl-mode:kill-contents t))
+    (kotl-mode:beginning-of-cell)
+    (should (looking-at-p "$"))))
+
 (ert-deftest kotl-mode-kill-cell ()
   "Kotl-mode kill a cell test."
   (let ((kotl-file (make-temp-file "hypb" nil ".kotl")))
@@ -762,7 +787,7 @@
 
 (ert-deftest kotl-mode-move-up-from-first-line-shall-message-and-beep ()
   "Trying to move up from first line shall beep and output a message.
-In non-interactive mode there shall be no beep nor message."
+In non interactive mode there shall be no beep (nor message)"
   (skip-unless (not noninteractive))
   (let ((kotl-file (make-temp-file "hypb" nil ".kotl")))
     (unwind-protect
@@ -773,27 +798,36 @@ In non-interactive mode there shall be no beep nor 
message."
             (mock (message "(kotl-mode:previous-line): Beginning of buffer") 
=> t)
             (mock (beep) => t)
             (funcall-interactively 'kotl-mode:previous-line 1))
-          ;; Non-interactive neither calls message nor beeps, so the mock 
fails.
-          (should-error
+          (should-error ;; Verifies no beep
            (with-mock
              (mock (beep) => t)
+             (kotl-mode:previous-line 1)))
+          (should-error ;; Verifies no message
+           (with-mock
+             (mock (message "(kotl-mode:previous-line): Beginning of buffer") 
=> t)
              (kotl-mode:previous-line 1))))
       (hy-delete-file-and-buffer kotl-file))))
 
 (ert-deftest kotl-mode-move-up-to-first-line ()
-  "Trying to move up from first line shall beep and output a message.
-In non-interactive mode there shall be no beep nor message."
+  "Move up to first line shall succeed with no beep nor message."
   (skip-unless (not noninteractive))
   (let ((kotl-file (make-temp-file "hypb" nil ".kotl")))
     (unwind-protect
         (progn
           (find-file kotl-file)
-          (insert "1\n2")
-          (funcall-interactively 'kotl-mode:previous-line 1)
+          (insert "1")
+          (kotl-mode:newline 1)
+          (insert "2")
+          (should-error ;; Verifies no beep
+           (with-mock
+             (mock (beep) => t)
+             (funcall-interactively 'kotl-mode:previous-line 1)))
          (should (= (line-number-at-pos) 1))
-          ;; Non-interactive test
-         (kotl-mode:next-line 1)
-         (kotl-mode:previous-line 1)
+          (kotl-mode:next-line 1)
+          (should-error ;; Verifies no message
+           (with-mock
+             (mock (message "(kotl-mode:previous-line): Beginning of buffer") 
=> t)
+             (funcall-interactively 'kotl-mode:previous-line 1)))
          (should (= (line-number-at-pos) 1)))
       (hy-delete-file-and-buffer kotl-file))))
 
@@ -810,10 +844,13 @@ In non-interactive mode there shall be no beep nor 
message."
             (mock (message "(kotl-mode:next-line): End of buffer") => t)
             (mock (beep) => t)
             (funcall-interactively 'kotl-mode:next-line 1))
-          ;; Non-interactive neither calls message nor beeps, so the mock 
fails.
-          (should-error
+          (should-error ;; Verifies no beep
            (with-mock
              (mock (beep) => t)
+             (kotl-mode:next-line 1)))
+          (should-error ;; Verifies no message
+           (with-mock
+             (mock (message "(kotl-mode:next-line): End of buffer") => t)
              (kotl-mode:next-line 1))))
       (hy-delete-file-and-buffer kotl-file))))
 
@@ -828,12 +865,16 @@ In non-interactive mode there shall be no beep nor 
message."
           (kotl-mode:newline 1)
           (insert "2")
           (kotl-mode:beginning-of-buffer)
-          ;; Non interactive does not call neither message nor beep so
-          ;; the mock will fails.
-          (should-error
+          (should-error ;; Verifies no beep
            (with-mock
              (mock (beep) => t)
              (funcall-interactively 'kotl-mode:next-line 1)))
+          (should (kotl-mode:last-line-p))
+          (kotl-mode:beginning-of-buffer)
+          (should-error ;; Verifies no message
+           (with-mock
+             (mock (message "(kotl-mode:next-line): End of buffer") => t)
+             (funcall-interactively 'kotl-mode:next-line 1)))
           (should (kotl-mode:last-line-p)))
       (hy-delete-file-and-buffer kotl-file))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]