* test/lisp/emacs-lisp/cl-lib-tests.el: Improve symbol-macrolet tests

(cl-lib-symbol-macrolet): Fix last test so it doesn't break the whole
test suite.
(cl-lib-symbol-macrolet-2): New test.
This commit is contained in:
Stefan Monnier 2017-04-01 12:11:07 -04:00
parent 9cf6a408c8
commit acce29d6c5

View file

@ -494,12 +494,29 @@
(should-not (cl-typep 1 'cl-lib-test-type)))
(ert-deftest cl-lib-symbol-macrolet ()
;; bug#26325
:expected-result :failed
(should (equal (cl-flet ((f (x) (+ x 5)))
(let ((x 5))
(f (+ x 6))))
(cl-symbol-macrolet ((f (+ x 6)))
(cl-flet ((f (x) (+ x 5)))
(let ((x 5))
(f f)))))))
;; Go through `eval', otherwise the macro-expansion
;; error prevents running the whole test suite :-(
(eval '(cl-symbol-macrolet ((f (+ x 6)))
(cl-flet ((f (x) (+ x 5)))
(let ((x 5))
(f f))))
t))))
(defmacro cl-lib-symbol-macrolet-4+5 ()
;; bug#26068
(let* ((sname "x")
(s1 (make-symbol sname))
(s2 (make-symbol sname)))
`(cl-symbol-macrolet ((,s1 4)
(,s2 5))
(+ ,s1 ,s2))))
(ert-deftest cl-lib-symbol-macrolet-2 ()
(should (equal (cl-lib-symbol-macrolet-4+5) (+ 4 5))))
;;; cl-lib.el ends here