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

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

[nongnu] elpa/iedit acb9fa54f3 152/301: Fix the testcase for iedit-hide-


From: ELPA Syncer
Subject: [nongnu] elpa/iedit acb9fa54f3 152/301: Fix the testcase for iedit-hide-unmatched-lines
Date: Mon, 10 Jan 2022 22:58:58 -0500 (EST)

branch: elpa/iedit
commit acb9fa54f3b1d067ebb948cf280f2203d8e65cf0
Author: Victor Ren <victorhge@gmail.com>
Commit: Victor Ren <victorhge@gmail.com>

    Fix the testcase for iedit-hide-unmatched-lines
---
 iedit-lib.el   | 15 +++++++--------
 iedit-tests.el | 25 ++++++++++++++++++-------
 2 files changed, 25 insertions(+), 15 deletions(-)

diff --git a/iedit-lib.el b/iedit-lib.el
index 7697543c3d..b3f1207d77 100644
--- a/iedit-lib.el
+++ b/iedit-lib.el
@@ -3,7 +3,7 @@
 
 ;; Copyright (C) 2010, 2011, 2012 Victor Ren
 
-;; Time-stamp: <2013-01-19 00:31:41 Victor Ren>
+;; Time-stamp: <2013-01-19 22:00:41 Victor Ren>
 ;; Author: Victor Ren <victorhge@gmail.com>
 ;; Keywords: occurrence region simultaneous rectangle refactoring
 ;; Version: 0.97
@@ -519,20 +519,19 @@ value of `iedit-occurrence-context-lines' is used for 
this time."
     (save-excursion
       (iedit-first-occurrence)
       (while (/= (point) (point-max))
+        ;; Now at the beginning of an occurrence
         (let ((current-start (point)))
           (forward-line (- context-lines))
           (let ((line-beginning (line-beginning-position)))
             (if (> line-beginning prev-occurrence-end)
-                (push  (list prev-occurrence-end (1- line-beginning)) 
unmatched-lines)))        
-          (goto-char current-start))
-        ;; goto the end of the occurrence
-        (goto-char (next-single-char-property-change (point) 
'iedit-occurrence-overlay-name))
+                (push  (list prev-occurrence-end (1- line-beginning)) 
unmatched-lines)))
+          ;; goto the end of the occurrence
+          (goto-char (next-single-char-property-change current-start 
'iedit-occurrence-overlay-name)))
         (let ((current-end (point)))
           (forward-line context-lines)
           (setq prev-occurrence-end (1+ (line-end-position)))
-          (goto-char current-end))
-        ;; goto the beginning of next occurrence
-        (goto-char (next-single-char-property-change (point) 
'iedit-occurrence-overlay-name)))
+          ;; goto the beginning of next occurrence
+          (goto-char (next-single-char-property-change current-end 
'iedit-occurrence-overlay-name))))
       (if (< prev-occurrence-end (point-max))
           (push (list prev-occurrence-end (point-max)) unmatched-lines))
       (when unmatched-lines
diff --git a/iedit-tests.el b/iedit-tests.el
index cdba17640c..12511f7955 100644
--- a/iedit-tests.el
+++ b/iedit-tests.el
@@ -2,7 +2,7 @@
 
 ;; Copyright (C) 2010, 2011, 2012 Victor Ren
 
-;; Time-stamp: <2013-01-19 21:32:53 Victor Ren>
+;; Time-stamp: <2013-01-19 22:18:17 Victor Ren>
 ;; Author: Victor Ren <victorhge@gmail.com>
 ;; Version: 0.97
 ;; X-URL: http://www.emacswiki.org/emacs/Iedit
@@ -599,22 +599,33 @@ abcd" 
"12345678901234567890123456789012345678901234567890...")))
   "Test function iedit-hide-unmatched-lines."
   (with-iedit-test-fixture
    "foo
+foo
 a
-  foo
+  foo bar
 a
 a
-barfoo
+bar foo
 a
 a
 a
+bar foo
 a
- foo"
+a
+a
+a
+ foo bar
+a
+a
+a
+a
+a
+foo"
    (lambda ()
-     (should (equal (iedit-hide-unmatched-lines 0) nil))
+     (should (equal (iedit-hide-unmatched-lines 0) '((64 73) (47 54) (33 38) 
(21 24) (9 10))))
      (iedit-show-all)
-     (should (equal (iedit-hide-unmatched-lines 1) '((14 29))))
+     (should (equal (iedit-hide-unmatched-lines 1) '((66 71) (49 52) (35 36))))
      (iedit-show-all)
-     (should (equal (iedit-hide-unmatched-lines 2) '((6 8))))
+     (should (equal (iedit-hide-unmatched-lines 2) '((68 69)) ))
      (iedit-show-all)
      (should (equal (iedit-hide-unmatched-lines 3) nil)))))
 



reply via email to

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