]> git.eshelyaron.com Git - emacs.git/commitdiff
* test/lisp/emacs-lisp/bytecomp-tests.el
authorGlenn Morris <rgm@gnu.org>
Tue, 27 Mar 2018 01:56:33 +0000 (21:56 -0400)
committerGlenn Morris <rgm@gnu.org>
Tue, 27 Mar 2018 01:56:33 +0000 (21:56 -0400)
(bytecomp-test-featurep-warnings): New.

test/lisp/emacs-lisp/bytecomp-tests.el

index 7330c676140e850ef07fae878f6549cd6777fcce..7c5aa9abedd75c52691b7ff12f3483ee0b7518c1 100644 (file)
@@ -27,6 +27,7 @@
 
 (require 'ert)
 (require 'cl-lib)
+(require 'bytecomp)
 
 ;;; Code:
 (defconst byte-opt-testsuite-arith-data
@@ -571,6 +572,38 @@ literals (Bug#20852)."
     (goto-char (point-min))
     (should-not (search-forward "Warning" nil t))))
 
+(ert-deftest bytecomp-test-featurep-warnings ()
+  (let ((byte-compile-log-buffer (generate-new-buffer " *Compile-Log*")))
+    (unwind-protect
+        (progn
+          (with-temp-buffer
+            (insert "\
+\(defun foo ()
+  (an-undefined-function))
+
+\(defun foo1 ()
+  (if (featurep 'xemacs)
+      (some-undefined-function-if)))
+
+\(defun foo2 ()
+  (and (featurep 'xemacs)
+      (some-undefined-function-and)))
+
+\(defun foo3 ()
+  (if (not (featurep 'emacs))
+      (some-undefined-function-not)))
+
+\(defun foo4 ()
+  (or (featurep 'emacs)
+      (some-undefined-function-or)))
+")
+            (byte-compile-from-buffer (current-buffer)))
+          (with-current-buffer byte-compile-log-buffer
+            (should (search-forward "an-undefined-function" nil t))
+            (should-not (search-forward "some-undefined-function" nil t))))
+      (if (buffer-live-p byte-compile-log-buffer)
+          (kill-buffer byte-compile-log-buffer)))))
+
 ;; Local Variables:
 ;; no-byte-compile: t
 ;; End: