mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-30 12:21:25 -08:00
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.
This commit is contained in:
parent
30c2ef6d6a
commit
f699b6e4f4
2 changed files with 47 additions and 47 deletions
|
|
@ -212,21 +212,7 @@
|
|||
(goto-char (point-min))
|
||||
(should-error (forward-sexp)))) ;; FIXME: Shouldn't be an error.
|
||||
|
||||
;; Test some core Elisp rules.
|
||||
(defvar c-e-x)
|
||||
(ert-deftest core-elisp-tests-1-defvar-in-let ()
|
||||
"Test some core Elisp rules."
|
||||
(with-temp-buffer
|
||||
;; Check that when defvar is run within a let-binding, the toplevel default
|
||||
;; is properly initialized.
|
||||
(should (equal (list (let ((c-e-x 1)) (defvar c-e-x 2) c-e-x) c-e-x)
|
||||
'(1 2)))
|
||||
(should (equal (list (let ((c-e-x 1))
|
||||
(defcustom c-e-x 2 "doc" :group 'blah :type 'integer) c-e-x)
|
||||
c-e-x)
|
||||
'(1 2)))))
|
||||
|
||||
(ert-deftest core-elisp-tests-2-window-configurations ()
|
||||
(ert-deftest core-elisp-tests-1-window-configurations ()
|
||||
"Test properties of window-configurations."
|
||||
(let ((wc (current-window-configuration)))
|
||||
(with-current-buffer (window-buffer (frame-selected-window))
|
||||
|
|
@ -235,40 +221,10 @@
|
|||
(set-window-configuration wc)
|
||||
(should (or (not mark-active) (mark)))))
|
||||
|
||||
(ert-deftest core-elisp-tests-3-backquote ()
|
||||
;; For variable binding tests, see src/data-tests.el.
|
||||
(ert-deftest core-elisp-tests-2-backquote ()
|
||||
(should (eq 3 (eval ``,,'(+ 1 2) t))))
|
||||
|
||||
(defvar-local c-e-l 'foo)
|
||||
(ert-deftest core-elisp-tests-4-toplevel-values ()
|
||||
(setq-default c-e-l 'foo)
|
||||
(let ((c-e-l 'bar))
|
||||
(let ((c-e-l 'baz))
|
||||
(setq-default c-e-l 'bar)
|
||||
(should (eq c-e-l 'bar))
|
||||
(should (eq (default-toplevel-value 'c-e-l) 'foo))
|
||||
(set-default-toplevel-value 'c-e-l 'baz)
|
||||
(should (eq c-e-l 'bar))
|
||||
(should (eq (default-toplevel-value 'c-e-l) 'baz))))
|
||||
(let ((c-e-u 'foo))
|
||||
(should (condition-case _
|
||||
(default-toplevel-value 'c-e-u)
|
||||
(void-variable t))))
|
||||
(with-temp-buffer
|
||||
(setq-local c-e-l 'bar)
|
||||
(should (eq (buffer-local-toplevel-value 'c-e-l) 'bar))
|
||||
(let ((c-e-l 'baz))
|
||||
(let ((c-e-l 'quux))
|
||||
(setq-local c-e-l 'baz)
|
||||
(should (eq c-e-l 'baz))
|
||||
(should (eq (buffer-local-toplevel-value 'c-e-l) 'bar))
|
||||
(set-buffer-local-toplevel-value 'c-e-l 'foo)
|
||||
(should (eq c-e-l 'baz))
|
||||
(should (eq (buffer-local-toplevel-value 'c-e-l) 'foo)))))
|
||||
(with-temp-buffer
|
||||
(should (condition-case _
|
||||
(buffer-local-toplevel-value 'c-e-l)
|
||||
(void-variable t)))))
|
||||
|
||||
;; Test up-list and backward-up-list.
|
||||
(defun lisp-run-up-list-test (fn data start instructions)
|
||||
(cl-labels ((posof (thing)
|
||||
|
|
|
|||
|
|
@ -354,6 +354,19 @@ comparing the subr with a much slower Lisp implementation."
|
|||
(setq-default binding-test-some-local 'new-default))
|
||||
(should (eq binding-test-some-local 'some))))
|
||||
|
||||
(defvar c-e-x)
|
||||
(ert-deftest binding-test-defvar-in-let ()
|
||||
"Test some core Elisp rules."
|
||||
(with-temp-buffer
|
||||
;; Check that when defvar is run within a let-binding, the toplevel default
|
||||
;; is properly initialized.
|
||||
(should (equal (list (let ((c-e-x 1)) (defvar c-e-x 2) c-e-x) c-e-x)
|
||||
'(1 2)))
|
||||
(should (equal (list (let ((c-e-x 1))
|
||||
(defcustom c-e-x 2 "doc" :group 'blah :type 'integer) c-e-x)
|
||||
c-e-x)
|
||||
'(1 2)))))
|
||||
|
||||
(ert-deftest data-tests--let-buffer-local ()
|
||||
(let ((blvar (make-symbol "blvar")))
|
||||
(set-default blvar nil)
|
||||
|
|
@ -396,6 +409,37 @@ comparing the subr with a much slower Lisp implementation."
|
|||
(should (equal (default-value var) def)))
|
||||
)))))
|
||||
|
||||
(defvar-local c-e-l 'foo)
|
||||
(ert-deftest binding-test-toplevel-values ()
|
||||
(setq-default c-e-l 'foo)
|
||||
(let ((c-e-l 'bar))
|
||||
(let ((c-e-l 'baz))
|
||||
(setq-default c-e-l 'bar)
|
||||
(should (eq c-e-l 'bar))
|
||||
(should (eq (default-toplevel-value 'c-e-l) 'foo))
|
||||
(set-default-toplevel-value 'c-e-l 'baz)
|
||||
(should (eq c-e-l 'bar))
|
||||
(should (eq (default-toplevel-value 'c-e-l) 'baz))))
|
||||
(let ((c-e-u 'foo))
|
||||
(should (condition-case _
|
||||
(default-toplevel-value 'c-e-u)
|
||||
(void-variable t))))
|
||||
(with-temp-buffer
|
||||
(setq-local c-e-l 'bar)
|
||||
(should (eq (buffer-local-toplevel-value 'c-e-l) 'bar))
|
||||
(let ((c-e-l 'baz))
|
||||
(let ((c-e-l 'quux))
|
||||
(setq-local c-e-l 'baz)
|
||||
(should (eq c-e-l 'baz))
|
||||
(should (eq (buffer-local-toplevel-value 'c-e-l) 'bar))
|
||||
(set-buffer-local-toplevel-value 'c-e-l 'foo)
|
||||
(should (eq c-e-l 'baz))
|
||||
(should (eq (buffer-local-toplevel-value 'c-e-l) 'foo)))))
|
||||
(with-temp-buffer
|
||||
(should (condition-case _
|
||||
(buffer-local-toplevel-value 'c-e-l)
|
||||
(void-variable t)))))
|
||||
|
||||
(ert-deftest binding-test-makunbound ()
|
||||
"Tests of makunbound, from the manual."
|
||||
(with-current-buffer binding-test-buffer-B
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue