diff options
| author | Sean Whitton | 2025-05-30 11:41:06 +0100 |
|---|---|---|
| committer | Sean Whitton | 2025-05-30 11:41:19 +0100 |
| commit | f699b6e4f409c0cc98703a2cea9b243ff8cb570a (patch) | |
| tree | cf2802bf84b0460b6516170dfaf6522e5fb098da /test/src | |
| parent | 30c2ef6d6ab73b913ee5c4da7b6cfc26477f5faa (diff) | |
| download | emacs-f699b6e4f409c0cc98703a2cea9b243ff8cb570a.tar.gz emacs-f699b6e4f409c0cc98703a2cea9b243ff8cb570a.zip | |
Gather variable binding tests in data-tests.el
* test/lisp/emacs-lisp/lisp-tests.el (c-e-x, c-e-l):
Move to data-tests.el.
(core-elisp-tests-2-window-configurations): Rename ...
(core-elisp-tests-1-window-configurations): ... to this.
(core-elisp-tests-3-backquote): Rename ...
(core-elisp-tests-2-backquote): ... to this.
(core-elisp-tests-1-defvar-in-let)
(core-elisp-tests-4-toplevel-values): Move and rename ...
* test/src/data-tests.el (binding-test-defvar-in-let)
(binding-test-toplevel-values): ... to these.
(c-e-x, c-e-l): Moved from data-tests.el.
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/data-tests.el | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/test/src/data-tests.el b/test/src/data-tests.el index 260bdb281bb..75be9856463 100644 --- a/test/src/data-tests.el +++ b/test/src/data-tests.el | |||
| @@ -354,6 +354,19 @@ comparing the subr with a much slower Lisp implementation." | |||
| 354 | (setq-default binding-test-some-local 'new-default)) | 354 | (setq-default binding-test-some-local 'new-default)) |
| 355 | (should (eq binding-test-some-local 'some)))) | 355 | (should (eq binding-test-some-local 'some)))) |
| 356 | 356 | ||
| 357 | (defvar c-e-x) | ||
| 358 | (ert-deftest binding-test-defvar-in-let () | ||
| 359 | "Test some core Elisp rules." | ||
| 360 | (with-temp-buffer | ||
| 361 | ;; Check that when defvar is run within a let-binding, the toplevel default | ||
| 362 | ;; is properly initialized. | ||
| 363 | (should (equal (list (let ((c-e-x 1)) (defvar c-e-x 2) c-e-x) c-e-x) | ||
| 364 | '(1 2))) | ||
| 365 | (should (equal (list (let ((c-e-x 1)) | ||
| 366 | (defcustom c-e-x 2 "doc" :group 'blah :type 'integer) c-e-x) | ||
| 367 | c-e-x) | ||
| 368 | '(1 2))))) | ||
| 369 | |||
| 357 | (ert-deftest data-tests--let-buffer-local () | 370 | (ert-deftest data-tests--let-buffer-local () |
| 358 | (let ((blvar (make-symbol "blvar"))) | 371 | (let ((blvar (make-symbol "blvar"))) |
| 359 | (set-default blvar nil) | 372 | (set-default blvar nil) |
| @@ -396,6 +409,37 @@ comparing the subr with a much slower Lisp implementation." | |||
| 396 | (should (equal (default-value var) def))) | 409 | (should (equal (default-value var) def))) |
| 397 | ))))) | 410 | ))))) |
| 398 | 411 | ||
| 412 | (defvar-local c-e-l 'foo) | ||
| 413 | (ert-deftest binding-test-toplevel-values () | ||
| 414 | (setq-default c-e-l 'foo) | ||
| 415 | (let ((c-e-l 'bar)) | ||
| 416 | (let ((c-e-l 'baz)) | ||
| 417 | (setq-default c-e-l 'bar) | ||
| 418 | (should (eq c-e-l 'bar)) | ||
| 419 | (should (eq (default-toplevel-value 'c-e-l) 'foo)) | ||
| 420 | (set-default-toplevel-value 'c-e-l 'baz) | ||
| 421 | (should (eq c-e-l 'bar)) | ||
| 422 | (should (eq (default-toplevel-value 'c-e-l) 'baz)))) | ||
| 423 | (let ((c-e-u 'foo)) | ||
| 424 | (should (condition-case _ | ||
| 425 | (default-toplevel-value 'c-e-u) | ||
| 426 | (void-variable t)))) | ||
| 427 | (with-temp-buffer | ||
| 428 | (setq-local c-e-l 'bar) | ||
| 429 | (should (eq (buffer-local-toplevel-value 'c-e-l) 'bar)) | ||
| 430 | (let ((c-e-l 'baz)) | ||
| 431 | (let ((c-e-l 'quux)) | ||
| 432 | (setq-local c-e-l 'baz) | ||
| 433 | (should (eq c-e-l 'baz)) | ||
| 434 | (should (eq (buffer-local-toplevel-value 'c-e-l) 'bar)) | ||
| 435 | (set-buffer-local-toplevel-value 'c-e-l 'foo) | ||
| 436 | (should (eq c-e-l 'baz)) | ||
| 437 | (should (eq (buffer-local-toplevel-value 'c-e-l) 'foo))))) | ||
| 438 | (with-temp-buffer | ||
| 439 | (should (condition-case _ | ||
| 440 | (buffer-local-toplevel-value 'c-e-l) | ||
| 441 | (void-variable t))))) | ||
| 442 | |||
| 399 | (ert-deftest binding-test-makunbound () | 443 | (ert-deftest binding-test-makunbound () |
| 400 | "Tests of makunbound, from the manual." | 444 | "Tests of makunbound, from the manual." |
| 401 | (with-current-buffer binding-test-buffer-B | 445 | (with-current-buffer binding-test-buffer-B |