aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJuri Linkov2023-06-29 10:13:06 +0300
committerJuri Linkov2023-06-29 10:13:06 +0300
commitd5cff340b3b4ab616bf4549150754cb99549afe3 (patch)
tree488cde990527d203ceadf35df64424c7667142b7 /test
parentef16339918e3f31831dd271cde40cb2072069875 (diff)
downloademacs-d5cff340b3b4ab616bf4549150754cb99549afe3.tar.gz
emacs-d5cff340b3b4ab616bf4549150754cb99549afe3.zip
* lisp/misc.el (duplicate-line-final-position): New defcustom (bug#64185).
* lisp/misc.el (duplicate-line): Use it. * test/lisp/misc-tests.el (misc--duplicate-line): Add tests for duplicate-line-final-position. Don't merge to master.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/misc-tests.el14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/lisp/misc-tests.el b/test/lisp/misc-tests.el
index f1d22e099b9..ea27ea1653b 100644
--- a/test/lisp/misc-tests.el
+++ b/test/lisp/misc-tests.el
@@ -88,6 +88,20 @@
88 (duplicate-line 2) 88 (duplicate-line 2)
89 (should (equal (buffer-string) "abc\ndefg\ndefg\ndefg\nh\n")) 89 (should (equal (buffer-string) "abc\ndefg\ndefg\ndefg\nh\n"))
90 (should (equal (point) 7))) 90 (should (equal (point) 7)))
91 ;; Duplicate a line (twice) and move point to the first duplicated line.
92 (with-temp-buffer
93 (insert "abc\ndefg\nh\n")
94 (goto-char 7)
95 (let ((duplicate-line-final-position 1)) (duplicate-line 2))
96 (should (equal (buffer-string) "abc\ndefg\ndefg\ndefg\nh\n"))
97 (should (equal (point) 12)))
98 ;; Duplicate a line (twice) and move point to the last duplicated line.
99 (with-temp-buffer
100 (insert "abc\ndefg\nh\n")
101 (goto-char 7)
102 (let ((duplicate-line-final-position -1)) (duplicate-line 2))
103 (should (equal (buffer-string) "abc\ndefg\ndefg\ndefg\nh\n"))
104 (should (equal (point) 17)))
91 ;; Duplicate a non-terminated line. 105 ;; Duplicate a non-terminated line.
92 (with-temp-buffer 106 (with-temp-buffer
93 (insert "abc") 107 (insert "abc")