New test custom--test-theme-variables

* test/lisp/custom-tests.el (custom--test-user-option)
(custom--test-variable): New variables.
(custom--test-theme-variables): New test.

* test/lisp/custom-resources/custom--test-theme.el (custom--test):
New file.
This commit is contained in:
Michael Albinus 2019-01-10 13:27:34 +01:00
parent f646675cd1
commit 7ae0a24c87
2 changed files with 48 additions and 0 deletions

View file

@ -0,0 +1,9 @@
(deftheme custom--test
"A test theme.")
(custom-theme-set-variables
'custom--test
'(custom--test-user-option 'bar)
'(custom--test-variable 'bar))
(provide-theme 'custom--test)

View file

@ -84,4 +84,43 @@
(when (file-directory-p tmpdir)
(delete-directory tmpdir t)))))
(defcustom custom--test-user-option 'foo
"User option for test."
:group 'emacs
:type 'symbol)
(defvar custom--test-variable 'foo
"Variable for test.")
;; This is demonstrating bug#34027.
(ert-deftest custom--test-theme-variables ()
"Test variables setting with enabling / disabling a custom theme."
:expected-result :failed
;; We load custom-resources/custom--test-theme.el.
(let ((custom-theme-load-path
`(,(expand-file-name "custom-resources" (file-name-directory #$)))))
(load-theme 'custom--test 'no-confirm 'no-enable)
;; The variables have still their initial values.
(should (equal custom--test-user-option 'foo))
(should (equal custom--test-variable 'foo))
(custom-set-variables
'(custom--test-user-option 'baz)
'(custom--test-variable 'baz))
;; The initial values have been changed.
(should (equal custom--test-user-option 'baz))
(should (equal custom--test-variable 'baz))
(enable-theme 'custom--test)
;; The variables have the theme values.
(should (equal custom--test-user-option 'bar))
(should (equal custom--test-variable 'bar))
(disable-theme 'custom--test)
;; The variables should have the changed values, by reverting.
;; This doesn't work as expected. Instead, they have their
;; initial values `foo'.
(should (equal custom--test-user-option 'baz))
(should (equal custom--test-variable 'baz))))
;;; custom-tests.el ends here