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

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

[elpa] externals/hyperbole e75a1d30d4 01/16: Add tests for pathname with


From: ELPA Syncer
Subject: [elpa] externals/hyperbole e75a1d30d4 01/16: Add tests for pathname with line number specification
Date: Tue, 1 Aug 2023 03:58:10 -0400 (EDT)

branch: externals/hyperbole
commit e75a1d30d4e71395df4c7cecb4fbbd4b147a9977
Author: Mats Lidell <mats.lidell@lidells.se>
Commit: Mats Lidell <mats.lidell@lidells.se>

    Add tests for pathname with line number specification
---
 ChangeLog                |  6 ++++++
 test/hmouse-drv-tests.el | 39 ++++++++++++++++++++++++++++++++++++++-
 2 files changed, 44 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 576ec5365f..545ee5368e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2023-07-14  Mats Lidell  <matsl@gnu.org>
+
+* test/hmouse-drv-tests.el (hbut-pathname-line-test)
+    (hbut-pathname-line-test-duplicate):  Add tests for pathname with line
+    number specification.
+
 2023-07-13  Mats Lidell  <matsl@gnu.org>
 
 * test/hmouse-drv-tests.el (hbut-pathname-anchor-must-match-all)
diff --git a/test/hmouse-drv-tests.el b/test/hmouse-drv-tests.el
index 99062bce2c..8f33a00dcd 100644
--- a/test/hmouse-drv-tests.el
+++ b/test/hmouse-drv-tests.el
@@ -3,7 +3,7 @@
 ;; Author:       Mats Lidell <matsl@gnu.org>
 ;;
 ;; Orig-Date:    28-Feb-21 at 22:52:00
-;; Last-Mod:     13-Jul-23 at 00:45:55 by Mats Lidell
+;; Last-Mod:     14-Jul-23 at 23:40:55 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -271,6 +271,43 @@
         (should (string= "hyperbole.el" (buffer-name))))
     (kill-buffer "hyperbole.el")))
 
+(ert-deftest hbut-pathname-line-test ()
+  "Pathname with line number specification."
+  (let ((file (make-temp-file "hypb" nil nil
+                              "Line1\nLine2\n")))
+    (unwind-protect
+        (with-temp-buffer
+          (insert (concat "\"" file ":1\""))
+          (goto-char 2)
+          (action-key)
+          (should (string= file (buffer-file-name)))
+          (should (looking-at "Line1")))
+      (hy-delete-file-and-buffer file))))
+
+(ert-deftest hbut-pathname-line-test-duplicate ()
+  "Pathname with line number specification, duplicate ibut to same file.
+
+BUG: See FIXME: The ibut link goes to the wrong line.  Is there a
+problem with a mix up when there are multiple ibuts to the same
+file but with different lines specifications?"
+  (let* ((file
+          (make-temp-file "hypb" nil nil
+                          "Line1\nLine2\n"))
+         (ibutfile
+           (make-temp-file "hypb" nil nil
+                           (concat "\"" file ":1\"" "\n" "\"" file ":2\"\n"))))
+    (unwind-protect
+        (progn
+          (find-file ibutfile)
+          (forward-line)
+          (should (looking-at-p (concat "\"" file ":2\"")))
+          (forward-char 2)
+          (action-key)
+          (should (string= file (buffer-file-name)))
+          (should (looking-at "Line1"))) ; FIXME: Should be looking a Line2
+      (hy-delete-file-and-buffer file)
+      (hy-delete-file-and-buffer ibutfile))))
+
 (ert-deftest hbut-pathname-anchor-test ()
   "Pathname with anchor."
   (let ((file (make-temp-file "hypb" nil nil



reply via email to

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