1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-02 08:22:22 +00:00

* test/automated/simple-test.el: Add test for bug#20698 (bug#21885)

(simple-test--transpositions): New macro.
(simple-transpose-subr): New test.

Backport.
This commit is contained in:
Juanma Barranquero 2015-11-13 14:09:35 +01:00 committed by Eli Zaretskii
parent e53f2266d4
commit 93e7db13d6

View File

@ -34,6 +34,17 @@
(buffer-substring (point) (point-max)))))
(defmacro simple-test--transpositions (&rest body)
(declare (indent 0)
(debug t))
`(with-temp-buffer
(emacs-lisp-mode)
(insert "(s1) (s2) (s3) (s4) (s5)")
(backward-sexp 1)
,@body
(cons (buffer-substring (point-min) (point))
(buffer-substring (point) (point-max)))))
;;; `newline'
(ert-deftest newline ()
@ -233,6 +244,12 @@
(car buffer-undo-list)
(undo-auto--boundaries 'test))))
;;; Transposition with negative args (bug#20698, bug#21885)
(ert-deftest simple-transpose-subr ()
(should (equal (simple-test--transpositions (transpose-sexps -1))
'("(s1) (s2) (s4)" . " (s3) (s5)")))
(should (equal (simple-test--transpositions (transpose-sexps -2))
'("(s1) (s4)" . " (s2) (s3) (s5)"))))
(provide 'simple-test)