emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/compat 2e6f7b14ae 1/6: Add ignore-error test


From: ELPA Syncer
Subject: [elpa] externals/compat 2e6f7b14ae 1/6: Add ignore-error test
Date: Wed, 4 Jan 2023 18:57:25 -0500 (EST)

branch: externals/compat
commit 2e6f7b14ae4b0dafebefb53694b9d77229a1a00c
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    Add ignore-error test
---
 compat-27.el    |  2 +-
 compat-tests.el | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/compat-27.el b/compat-27.el
index 9d90dce150..80684e1e46 100644
--- a/compat-27.el
+++ b/compat-27.el
@@ -401,7 +401,7 @@ If you just want to check `major-mode', use 
`derived-mode-p'."
 Uses the `derived-mode-parent' property of the symbol to trace backwards."
   (apply #'provided-mode-derived-p major-mode modes))
 
-(compat-defmacro ignore-error (condition &rest body) ;; <UNTESTED>
+(compat-defmacro ignore-error (condition &rest body) ;; <OK>
   "Execute BODY; if the error CONDITION occurs, return nil.
 Otherwise, return result of last form in BODY.
 
diff --git a/compat-tests.el b/compat-tests.el
index 5d6f1786f0..91ec545f63 100644
--- a/compat-tests.el
+++ b/compat-tests.el
@@ -46,6 +46,16 @@
 (defmacro should-equal (a b)
   `(should (equal ,a ,b)))
 
+(ert-deftest ignore-error ()
+  (should-equal (ignore-error (end-of-file)
+                  (read ""))
+                nil)
+  (should-equal (ignore-error end-of-file
+                  (read ""))
+                nil)
+  (should-error (ignore-error foo
+                  (read ""))))
+
 (ert-deftest thread-first ()
   (should-equal (thread-first (+ 40 2)) 42)
   (should-equal (thread-first



reply via email to

[Prev in Thread] Current Thread [Next in Thread]