summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuanma Barranquero <lekktu@gmail.com>2015-11-13 14:09:35 +0100
committerEli Zaretskii <eliz@gnu.org>2015-11-13 22:00:59 +0200
commit93e7db13d60ea04b3b32cdd4bf0de7a4cda25021 (patch)
tree2e8b8c91ef1023d15105b5819d9ec1adbef3a66d
parente53f2266d41bd4ca61bdc0518accb32f4b7b81ed (diff)
downloademacs-93e7db13d60ea04b3b32cdd4bf0de7a4cda25021.tar.gz
emacs-93e7db13d60ea04b3b32cdd4bf0de7a4cda25021.tar.bz2
emacs-93e7db13d60ea04b3b32cdd4bf0de7a4cda25021.zip
* test/automated/simple-test.el: Add test for bug#20698 (bug#21885)
(simple-test--transpositions): New macro. (simple-transpose-subr): New test. Backport.
-rw-r--r--test/automated/simple-test.el17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/automated/simple-test.el b/test/automated/simple-test.el
index 86c9fc2e767..07b5eaa93e4 100644
--- a/test/automated/simple-test.el
+++ b/test/automated/simple-test.el
@@ -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)