summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2022-05-03 22:30:39 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2022-05-03 22:30:39 +0200
commitc761ded251f281236e835df2d23ba5669499abf6 (patch)
tree6470ed481bbe02064a1f612de731e01f8a726447
parent0a2f0e7f8c1ba54d160322c52865feef3e67d79c (diff)
downloademacs-c761ded251f281236e835df2d23ba5669499abf6.tar.gz
Make some recently added tests actually run
-rw-r--r--test/lisp/emacs-lisp/subr-x-tests.el34
-rw-r--r--test/lisp/sort-tests.el33
-rw-r--r--test/lisp/subr-tests.el5
3 files changed, 37 insertions, 35 deletions
diff --git a/test/lisp/emacs-lisp/subr-x-tests.el b/test/lisp/emacs-lisp/subr-x-tests.el
index d38a8e2352b..dca7df63098 100644
--- a/test/lisp/emacs-lisp/subr-x-tests.el
+++ b/test/lisp/emacs-lisp/subr-x-tests.el
@@ -712,5 +712,39 @@
(loop (cdr rest) (+ sum (car rest))))))
(should (equal (mapcar #'funcall funs) '(43 1 0)))))
+(ert-deftest test-with-buffer-unmodified-if-unchanged ()
+ (with-temp-buffer
+ (with-buffer-unmodified-if-unchanged
+ (insert "t"))
+ (should (buffer-modified-p)))
+
+ (with-temp-buffer
+ (with-buffer-unmodified-if-unchanged
+ (insert "t")
+ (delete-char -1))
+ (should (not (buffer-modified-p))))
+
+ ;; Shouldn't error.
+ (should
+ (with-temp-buffer
+ (let ((inner (current-buffer)))
+ (with-buffer-unmodified-if-unchanged
+ (insert "t")
+ (delete-char -1)
+ (kill-buffer (current-buffer))
+ t))))
+
+ (with-temp-buffer
+ (let ((outer (current-buffer)))
+ (with-temp-buffer
+ (let ((inner (current-buffer)))
+ (with-buffer-unmodified-if-unchanged
+ (insert "t")
+ (delete-char -1)
+ (set-buffer outer))
+ (with-current-buffer inner
+ (should (not (buffer-modified-p)))))))))
+
+
(provide 'subr-x-tests)
;;; subr-x-tests.el ends here
diff --git a/test/lisp/sort-tests.el b/test/lisp/sort-tests.el
index 5fcae308d6a..7f49cc38d1b 100644
--- a/test/lisp/sort-tests.el
+++ b/test/lisp/sort-tests.el
@@ -106,38 +106,5 @@ reversing the sort."
:generator (lambda (n) (concat (sort-tests-random-word n) " " (sort-tests-random-word n)))
:less-pred (lambda (a b) (string< (field-n a 2) (field-n b 2))))))
-(defun test-with-buffer-unmodified-if-unchanged ()
- (with-temp-buffer
- (with-buffer-unmodified-if-unchanged
- (insert "t"))
- (should (buffer-modified-p)))
-
- (with-temp-buffer
- (with-buffer-unmodified-if-unchanged
- (insert "t")
- (delete-char -1))
- (should (not (buffer-modified-p))))
-
- ;; Shouldn't error.
- (should
- (with-temp-buffer
- (let ((inner (current-buffer)))
- (with-buffer-unmodified-if-unchanged
- (insert "t")
- (delete-char -1)
- (kill-buffer (current-buffer))
- t))))
-
- (with-temp-buffer
- (let ((outer (current-buffer)))
- (with-temp-buffer
- (let ((inner (current-buffer)))
- (with-buffer-unmodified-if-unchanged
- (insert "t")
- (delete-char -1)
- (set-buffer outer))
- (with-current-buffer inner
- (should (not (buffer-modified-p)))))))))
-
(provide 'sort-tests)
;;; sort-tests.el ends here
diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el
index a4f531ea4e6..3725f180f3a 100644
--- a/test/lisp/subr-tests.el
+++ b/test/lisp/subr-tests.el
@@ -1053,9 +1053,10 @@ final or penultimate step during initialization."))
(should (equal (string-lines "foo\n\n\nbar" t t)
'("foo\n" "bar"))))
-(defun test-keymap-parse-macros ()
+(ert-deftest test-keymap-parse-macros ()
(should (equal (key-parse "C-x ( C-d C-x )") [24 40 4 24 41]))
- (should (equal (kbd "C-x ( C-d C-x )") "")))
+ (should (equal (kbd "C-x ( C-d C-x )") ""))
+ (should (equal (kbd "C-x ( C-x )") "")))
(provide 'subr-tests)
;;; subr-tests.el ends here