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

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

[nongnu] elpa/iedit 4b1416f83f 131/301: refactor out common test code in


From: ELPA Syncer
Subject: [nongnu] elpa/iedit 4b1416f83f 131/301: refactor out common test code in "test-util"
Date: Mon, 10 Jan 2022 22:58:56 -0500 (EST)

branch: elpa/iedit
commit 4b1416f83ffc5b1c8b6f97c48fdf95569dd7c160
Author: Le Wang <le.wang@agworld.com.au>
Commit: Le Wang <le.wang@agworld.com.au>

    refactor out common test code in "test-util"
---
 iedit-tests.el |  7 ++++---
 test-util.el   | 14 ++++++++++++++
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/iedit-tests.el b/iedit-tests.el
index 90e7c921e2..8fc90096a6 100644
--- a/iedit-tests.el
+++ b/iedit-tests.el
@@ -29,6 +29,7 @@
 
 ;;; Code:
 (require 'ert)
+(require 'test-util)
 (require 'iedit)
 (require 'iedit-rect)
 
@@ -425,7 +426,7 @@ fob")))))
    (forward-char 3)
    (forward-line 3)
    (call-interactively 'iedit-rectangle-mode)
-   (should (equal iedit-rectangle '(1 19))))))
+   (should (equal (marker-position-list iedit-rectangle) '(1 19))))))
 
 (ert-deftest iedit-kill-rectangle-error-test ()
   (with-iedit-test-fixture
@@ -439,7 +440,7 @@ fob")))))
    (goto-char 22)
    (call-interactively 'iedit-rectangle-mode)
    (should (iedit-same-column))
-   (should (equal iedit-rectangle '(1 22)))
+   (should (equal (marker-position-list iedit-rectangle) '(1 22)))
    (iedit-prev-occurrence)
    (delete-char -1)
    (should (not (iedit-same-column)))
@@ -457,7 +458,7 @@ fob")))))
    (goto-char 22)
    (call-interactively 'iedit-rectangle-mode)
    (should (iedit-same-column))
-   (should (equal iedit-rectangle '(1 22)))
+   (should (equal (marker-position-list iedit-rectangle) '(1 22)))
    (iedit-kill-rectangle)
    (should (string= (buffer-string)
 "
diff --git a/test-util.el b/test-util.el
new file mode 100644
index 0000000000..7cf5502f48
--- /dev/null
+++ b/test-util.el
@@ -0,0 +1,14 @@
+(defun marker-position-list (l)
+  "convert list of markers to positions"
+  (mapcar (lambda (m) (marker-position m)) l))
+
+(defun goto-word (word &optional beginning)
+  (goto-char (point-min))
+  (search-forward word)
+  (when beginning
+    (goto-char (- (point) (length word)))))
+
+(defun goto-word-beginning (word)
+  (goto-word word t))
+
+(provide 'test-util)
\ No newline at end of file



reply via email to

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