branch: elpa/evil-numbers
commit e5d4cbff1b35fcab5490a776d926d8e942895bf8
Author: Campbell Barton <[email protected]>
Commit: Campbell Barton <[email protected]>

    Tests: add regression test for bug #21
    
    Line selection with cursor at end now correctly increments all
    numbers in the selection, not just those after the cursor.
---
 tests/evil-numbers-tests.el | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/tests/evil-numbers-tests.el b/tests/evil-numbers-tests.el
index b8f1d7c4cc2..7a4247179d0 100644
--- a/tests/evil-numbers-tests.el
+++ b/tests/evil-numbers-tests.el
@@ -6,7 +6,7 @@
 
 ;; See: `evil-numbers-tests.sh' for launching this script.
 
-;; TODO: tests that handle bugs: #20, #21, #24, #26, #27.
+;; TODO: tests that handle bugs: #20, #24, #26, #27.
 ;; Bugs fixed in:
 ;; c37a4cf92a9cf8aa9f8bd752ea856a9d1bc6c84c
 
@@ -336,6 +336,23 @@
         "a|")
       (should (equal text-expected (buffer-string))))))
 
+;; See bug #21.
+(ert-deftest selected-line-cursor-at-end ()
+  "Line selection increments numbers before the cursor."
+  (let ((text-expected "2 2 2|\n")
+        (text-initial "1 1 1\n"))
+    (with-evil-numbers-test text-initial
+      (simulate-input
+        ;; Move to end of line (cursor after last number).
+        (kbd "<end>")
+        ;; Line select.
+        (kbd "V")
+        ;; Increment.
+        (kbd "C-a")
+        ;; Show cursor location.
+        "a|")
+      (should (equal text-expected (buffer-string))))))
+
 (ert-deftest selected-lines-incremental ()
   "Incremental line selection test."
   (let ((text-expected

Reply via email to