]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix subr-x-tests when running from elc
authorNoam Postavsky <npostavs@gmail.com>
Mon, 25 Sep 2017 11:15:51 +0000 (07:15 -0400)
committerNoam Postavsky <npostavs@gmail.com>
Mon, 25 Sep 2017 23:39:19 +0000 (19:39 -0400)
* test/lisp/emacs-lisp/subr-x-tests.el (subr-x-and-let*-test-group-1):
Use `eval' around the `should-error' cases.

test/lisp/emacs-lisp/subr-x-tests.el

index 2c6740a96cf876dc6c97b567d229ca6998dcb793..0e8871d9a9c073398d5108f5cc61aa8cf5da6bcf 100644 (file)
    (should (equal 1 (let ((x 1)) (and-let* (x)))))
    (should (equal nil (and-let* ((x nil)))))
    (should (equal 1 (and-let* ((x 1)))))
-   (should-error (and-let* (nil (x 1))) :type 'setting-constant)
+   ;; The error doesn't trigger when compiled: the compiler will give
+   ;; a warning and then drop the erroneous code.  Therefore, use
+   ;; `eval' to avoid compilation.
+   (should-error (eval '(and-let* (nil (x 1))) lexical-binding)
+                 :type 'setting-constant)
    (should (equal nil (and-let* ((nil) (x 1)))))
-   (should-error (and-let* (2 (x 1))) :type 'wrong-type-argument)
+   (should-error (eval (and-let* (2 (x 1))) lexical-binding)
+                 :type 'wrong-type-argument)
    (should (equal 1 (and-let* ((2) (x 1)))))
    (should (equal 2 (and-let* ((x 1) (2)))))
    (should (equal nil (let ((x nil)) (and-let* (x) x))))