emacs-diffs
[Top][All Lists]
Advanced

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

master 2baf08683fc: (bytecomp-warn--ignore): New test


From: Stefan Monnier
Subject: master 2baf08683fc: (bytecomp-warn--ignore): New test
Date: Sat, 25 Feb 2023 22:34:10 -0500 (EST)

branch: master
commit 2baf08683fcf4b6b1ad65a6dc239b889d78a74b2
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    (bytecomp-warn--ignore): New test
    
    Add tests for the interaction of `ignore` with warnings.
    
    * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-warn--ignore): New test.
    (bytecomp--with-warning-test): Really make it a function.
---
 test/lisp/emacs-lisp/bytecomp-tests.el | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el 
b/test/lisp/emacs-lisp/bytecomp-tests.el
index 00abe730948..185abaf5c22 100644
--- a/test/lisp/emacs-lisp/bytecomp-tests.el
+++ b/test/lisp/emacs-lisp/bytecomp-tests.el
@@ -888,8 +888,6 @@ byte-compiled.  Run with dynamic binding."
 
 (defun bytecomp--with-warning-test (re-warning form)
   (declare (indent 1))
-  `(bytecomp--with-warning-test-1 ,re-warning ,form))
-(defun bytecomp--with-warning-test-1 (re-warning form)
   (with-current-buffer (get-buffer-create "*Compile-Log*")
      (let ((inhibit-read-only t)) (erase-buffer))
      (let ((text-quoting-style 'grave)
@@ -901,6 +899,16 @@ byte-compiled.  Run with dynamic binding."
            (should (re-search-forward
                     (string-replace " " "[ \n]+" re-warning))))))))
 
+(ert-deftest bytecomp-warn--ignore ()
+  (bytecomp--with-warning-test "unused"
+    '(lambda (y) 6))
+  (bytecomp--with-warning-test "\\`\\'" ;No warning!
+    '(lambda (y) (ignore y) 6))
+  (bytecomp--with-warning-test "assq"
+    '(lambda (x y) (progn (assq x y) 5)))
+  (bytecomp--with-warning-test "\\`\\'" ;No warning!
+    '(lambda (x y) (progn (ignore (assq x y)) 5))))
+
 (ert-deftest bytecomp-warn-wrong-args ()
   (bytecomp--with-warning-test "remq.*3.*2"
     '(remq 1 2 3)))



reply via email to

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