branch: externals/hyperbole
commit c1636759c0775a5082e06fcef30889e845706179
Author: Mats Lidell <mats.lid...@lidells.se>
Commit: GitHub <nore...@github.com>

    Add test case for add-prior-cell and silence misc warnings (#728)
---
 ChangeLog               |  4 ++++
 hypb.el                 |  4 ++--
 kotl/kotl-mode.el       |  6 +++---
 test/kotl-mode-tests.el | 23 ++++++++++++++++++++++-
 4 files changed, 31 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 02f89582f9..6e1f1e44bc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2025-05-20  Mats Lidell  <ma...@gnu.org>
+
+* test/kotl-mode-tests.el (kotl-mode--add-prior-cell): Add test.
+
 2025-05-19  Bob Weiner  <r...@gnu.org>
 
 * test/demo-tests.el (fast-demo-elisp-or-env-vars): Fix to move past opening
diff --git a/hypb.el b/hypb.el
index 40b8bea6fd..ec6bb56db2 100644
--- a/hypb.el
+++ b/hypb.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:     6-Oct-91 at 03:42:38
-;; Last-Mod:     19-May-25 at 01:28:31 by Bob Weiner
+;; Last-Mod:     20-May-25 at 23:46:09 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -691,7 +691,7 @@ non-quoted quote mark.
 Quoting conventions recognized are:
   double-quotes:                 \"str\";
   Markdown triple backticks:     ```str```;
-  Python single-quotes:          'str';
+  Python single-quotes:          \\='str\\=';
   Python triple single-quotes:   '''str''';
   Python triple double-quotes:   \"\"\"str\"\"\";
   Texinfo open and close quotes: ``str''."
diff --git a/kotl/kotl-mode.el b/kotl/kotl-mode.el
index 189f6afdd2..ef9c5f0503 100644
--- a/kotl/kotl-mode.el
+++ b/kotl/kotl-mode.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    6/30/93
-;; Last-Mod:     18-May-25 at 10:16:26 by Bob Weiner
+;; Last-Mod:     20-May-25 at 00:35:26 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -2400,7 +2400,7 @@ Optional prefix arg RELATIVE-LEVEL means one of the 
following:
 
  1. when = 0, add as the parent's first child cell (first cell in list);
  2. when < 0, add that number of cells as preceding siblings;
- 3. when '(4) (universal arg, C-u), add as the first child of the current cell;
+ 3. when \\='(4) (universal arg, \\`C-u'), add as the first child of the 
current cell;
  4. when > 0 or nil (meaning 1), add that number of cells as following 
siblings."
   (interactive "*P")
   (unless (or (integerp relative-level) (listp relative-level) )
@@ -2511,7 +2511,7 @@ Optional prefix arg RELATIVE-LEVEL means one of the 
following:
 (defun kotl-mode:add-prior-cell (&optional cells-to-add contents plist no-fill)
   "Add prior sibling cells to the current cell.
 Optional prefix arg number of CELLS-TO-ADD defaults to 1.  Given
-a single universal arg, C-u, for CELLS-TO-ADD, add a single cell
+a single universal arg, \\`C-u', for CELLS-TO-ADD, add a single cell
 as the first child of the current cell's parent.  Always return the
 last cell added.
 
diff --git a/test/kotl-mode-tests.el b/test/kotl-mode-tests.el
index b02caab13e..969100c825 100644
--- a/test/kotl-mode-tests.el
+++ b/test/kotl-mode-tests.el
@@ -3,7 +3,7 @@
 ;; Author:       Mats Lidell <ma...@gnu.org>
 ;;
 ;; Orig-Date:    18-May-21 at 22:14:10
-;; Last-Mod:      4-May-25 at 11:16:56 by Bob Weiner
+;; Last-Mod:     20-May-25 at 00:38:20 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -1102,6 +1102,27 @@ marked with :ignore t")
       (kotl-mode--sanity-check-function (kotl-mode-tests--func-func f)
                                         (kotl-mode-tests--func-args f)))))
 
+(ert-deftest kotl-mode--add-prior-cell ()
+  "Verify `kotl-mode:add-prior-cell'."
+  (with-temp-buffer
+    (kotl-mode)
+    (let ((current-prefix-arg -4))
+      (should-error (call-interactively #'kotl-mode:add-prior-cell)))
+    (let ((current-prefix-arg '(4)))
+      (mocklet (((kotl-mode:add-below-parent) => t))
+        (should (call-interactively #'kotl-mode:add-prior-cell))))
+    (let ((current-prefix-arg 1))
+      (mocklet (((kotl-mode:backward-cell 1) => 0)
+                ((kotl-mode:add-cell 1 nil nil nil) => t))
+        (should (call-interactively #'kotl-mode:add-prior-cell)))
+      (mocklet (((kotl-mode:backward-cell 1) => 1))
+        (mocklet (((kotl-mode:up-level 1) => t)
+                  ((kotl-mode:add-child 1 nil nil nil) => t))
+          (should (call-interactively #'kotl-mode:add-prior-cell)))
+        (mocklet (((kotl-mode:up-level 1) => nil)
+                  ((kotl-mode:add-below-parent 1 nil nil nil) => t))
+          (should (call-interactively #'kotl-mode:add-prior-cell)))))))
+
 (provide 'kotl-mode-tests)
 
 ;; This file can't be byte-compiled without the `el-mock' package

Reply via email to