[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/7] Add a test for let-binding unwinding
From: |
Spencer Baugh |
Subject: |
[PATCH 1/7] Add a test for let-binding unwinding |
Date: |
Tue, 23 Mar 2021 23:11:51 -0400 |
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
---
test/src/data-tests.el | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/test/src/data-tests.el b/test/src/data-tests.el
index 03d867f18a..d0cb87293f 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
--
2.28.0
- [PATCH 0/7] Cleanups and tests for DEFVAR_PER_BUFFER variables, Spencer Baugh, 2021/03/23
- [PATCH 3/7] Stop checking the constant default for enable_multibyte_characters, Spencer Baugh, 2021/03/23
- [PATCH 4/7] Take buffer field name in DEFVAR_PER_BUFFER, Spencer Baugh, 2021/03/23
- [PATCH 2/7] Assert not local-variable-p after setq in let_default binding, Spencer Baugh, 2021/03/23
- [PATCH 1/7] Add a test for let-binding unwinding,
Spencer Baugh <=
- [PATCH 6/7] Assert that PER_BUFFER_IDX for Lisp variables is not 0, Spencer Baugh, 2021/03/23
- [PATCH 5/7] Combine unnecessarily separate loops in buffer.c, Spencer Baugh, 2021/03/23
- [PATCH 7/7] Remove unnecessary Qunbound check, Spencer Baugh, 2021/03/23
- Re: [PATCH 0/7] Cleanups and tests for DEFVAR_PER_BUFFER variables, Eli Zaretskii, 2021/03/24