[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 01/16] Add a test for let-binding unwinding
From: |
Spencer Baugh |
Subject: |
[PATCH v2 01/16] Add a test for let-binding unwinding |
Date: |
Sat, 21 Nov 2020 21:34:30 -0500 |
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 | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/test/src/data-tests.el b/test/src/data-tests.el
index 1312683c84..7e69b9c331 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
- Re: ido-switch-buffer is slow with many buffers; others are fast, (continued)
- Re: ido-switch-buffer is slow with many buffers; others are fast, Dmitry Gutov, 2020/11/14
- Re: ido-switch-buffer is slow with many buffers; others are fast, Spencer Baugh, 2020/11/14
- Re: ido-switch-buffer is slow with many buffers; others are fast, Stefan Monnier, 2020/11/15
- Re: ido-switch-buffer is slow with many buffers; others are fast, Spencer Baugh, 2020/11/15
- Re: ido-switch-buffer is slow with many buffers; others are fast, Arnold Noronha, 2020/11/15
- [PATCH 02/10] Add bset_save_length and use it, Spencer Baugh, 2020/11/19
- [PATCH 04/10] Use bset_enable_multibyte_characters everywhere, Spencer Baugh, 2020/11/19
- [PATCH 00/10] Speeding up DEFVAR_PER_BUFFER (Was: ido-switch-buffer is slow), Spencer Baugh, 2020/11/19
- Re: [PATCH 00/10] Speeding up DEFVAR_PER_BUFFER, Stefan Monnier, 2020/11/19
- [PATCH v2 00/16] Speeding up DEFVAR_PER_BUFFER, Spencer Baugh, 2020/11/21
- [PATCH v2 01/16] Add a test for let-binding unwinding,
Spencer Baugh <=
- Re: [PATCH v2 01/16] Add a test for let-binding unwinding, Stefan Monnier, 2020/11/25
- Re: [PATCH v2 01/16] Add a test for let-binding unwinding, Spencer Baugh, 2020/11/30
- [PATCH v2 05/16] Add BVAR_DEFAULT for access to buffer defaults, Spencer Baugh, 2020/11/21
- [PATCH v2 02/16] Assert not local-variable-p after setq in let_default binding, Spencer Baugh, 2020/11/21
- Re: [PATCH v2 02/16] Assert not local-variable-p after setq in let_default binding, Stefan Monnier, 2020/11/25
- [PATCH v2 03/16] Stop checking the constant default for enable_multibyte_characters, Spencer Baugh, 2020/11/21
- Re: [PATCH v2 03/16] Stop checking the constant default for enable_multibyte_characters, Stefan Monnier, 2020/11/25
- [PATCH v2 04/16] Take buffer field name in DEFVAR_PER_BUFFER, Spencer Baugh, 2020/11/21
- [PATCH v2 08/16] Combine unnecessarily separate loops in buffer.c, Spencer Baugh, 2020/11/21
- [PATCH v2 09/16] Add and use BUFFER_DEFAULT_VALUE_P, Spencer Baugh, 2020/11/21