From: Spencer Baugh Date: Wed, 24 Mar 2021 03:11:51 +0000 (-0400) Subject: Add a test for let-binding unwinding X-Git-Tag: emacs-28.0.90~3137 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=b29bf8181fe2c02becd0a3ac5e2f85cb0a3b58bf;p=emacs.git Add a test for let-binding unwinding Bindings in other buffers are not un-set when we unwind a let-binding which set the default value. There doesn't seem to be an existing test which covers this, so here's one. * test/src/data-tests.el (data-tests--let-buffer-local-no-unwind-other-buffers): Add test for let-binding unwinding behavior --- diff --git a/test/src/data-tests.el b/test/src/data-tests.el index 03d867f18a8..d0cb87293f0 100644 --- a/test/src/data-tests.el +++ b/test/src/data-tests.el @@ -364,6 +364,28 @@ comparing the subr with a much slower lisp implementation." (should (equal (default-value var) (symbol-value var)))) (should (equal (default-value var) def)))))) +(ert-deftest data-tests--let-buffer-local-no-unwind-other-buffers () + "Test that a let-binding for a buffer-local unwinds only current-buffer." + (let ((blvar (make-symbol "blvar"))) + (set-default blvar 0) + (make-variable-buffer-local blvar) + (dolist (var (list blvar 'left-margin)) + (let* ((def (default-value var)) + (newdef (+ def 1)) + (otherbuf (generate-new-buffer "otherbuf"))) + (with-temp-buffer + (cl-progv (list var) (list newdef) + (with-current-buffer otherbuf + (set var 123) + (should (local-variable-p var)) + (should (equal (symbol-value var) 123)) + (should (equal (default-value var) newdef)))) + (with-current-buffer otherbuf + (should (local-variable-p var)) + (should (equal (symbol-value var) 123)) + (should (equal (default-value var) def))) + ))))) + (ert-deftest binding-test-makunbound () "Tests of makunbound, from the manual." (with-current-buffer binding-test-buffer-B