diff options
| author | Spencer Baugh | 2021-03-23 23:11:51 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2021-03-25 12:38:50 -0400 |
| commit | b29bf8181fe2c02becd0a3ac5e2f85cb0a3b58bf (patch) | |
| tree | eeb991918f7d65279e2f5f347fa7d9dc59cab8ef /test | |
| parent | 55a7af9123b5c2c2cad8f768a1234b59b07f7afc (diff) | |
| download | emacs-b29bf8181fe2c02becd0a3ac5e2f85cb0a3b58bf.tar.gz emacs-b29bf8181fe2c02becd0a3ac5e2f85cb0a3b58bf.zip | |
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
Diffstat (limited to 'test')
| -rw-r--r-- | test/src/data-tests.el | 22 |
1 files changed, 22 insertions, 0 deletions
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." | |||
| 364 | (should (equal (default-value var) (symbol-value var)))) | 364 | (should (equal (default-value var) (symbol-value var)))) |
| 365 | (should (equal (default-value var) def)))))) | 365 | (should (equal (default-value var) def)))))) |
| 366 | 366 | ||
| 367 | (ert-deftest data-tests--let-buffer-local-no-unwind-other-buffers () | ||
| 368 | "Test that a let-binding for a buffer-local unwinds only current-buffer." | ||
| 369 | (let ((blvar (make-symbol "blvar"))) | ||
| 370 | (set-default blvar 0) | ||
| 371 | (make-variable-buffer-local blvar) | ||
| 372 | (dolist (var (list blvar 'left-margin)) | ||
| 373 | (let* ((def (default-value var)) | ||
| 374 | (newdef (+ def 1)) | ||
| 375 | (otherbuf (generate-new-buffer "otherbuf"))) | ||
| 376 | (with-temp-buffer | ||
| 377 | (cl-progv (list var) (list newdef) | ||
| 378 | (with-current-buffer otherbuf | ||
| 379 | (set var 123) | ||
| 380 | (should (local-variable-p var)) | ||
| 381 | (should (equal (symbol-value var) 123)) | ||
| 382 | (should (equal (default-value var) newdef)))) | ||
| 383 | (with-current-buffer otherbuf | ||
| 384 | (should (local-variable-p var)) | ||
| 385 | (should (equal (symbol-value var) 123)) | ||
| 386 | (should (equal (default-value var) def))) | ||
| 387 | ))))) | ||
| 388 | |||
| 367 | (ert-deftest binding-test-makunbound () | 389 | (ert-deftest binding-test-makunbound () |
| 368 | "Tests of makunbound, from the manual." | 390 | "Tests of makunbound, from the manual." |
| 369 | (with-current-buffer binding-test-buffer-B | 391 | (with-current-buffer binding-test-buffer-B |