From: Michael Albinus Date: Wed, 25 Nov 2020 11:18:23 +0000 (+0100) Subject: Merge from origin/emacs-27 X-Git-Tag: emacs-28.0.90~5030 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e45ad6b08e1e6639dfcca28c1a496df5b676f985;p=emacs.git Merge from origin/emacs-27 6442cdc0e4 Revert extra focus redirection in do_switch_frame (Bug#24803) fc4379f1ae Minor cleanup of tramp-tests.el on MS Windows dea3d6aa18 Fix handling of defcustom :local tag --- e45ad6b08e1e6639dfcca28c1a496df5b676f985 diff --cc test/lisp/custom-tests.el index 7691f167738,e71b7913f06..232e3bed439 --- a/test/lisp/custom-tests.el +++ b/test/lisp/custom-tests.el @@@ -145,24 -151,42 +145,62 @@@ (widget-apply field :value-to-internal origvalue) "bar")))))) +(defconst custom-test-admin-cus-test + (expand-file-name "admin/cus-test.el" source-directory)) + +(declare-function cus-test-opts custom-test-admin-cus-test) + +(ert-deftest check-for-wrong-custom-types () + :tags '(:expensive-test) + (skip-unless (file-readable-p custom-test-admin-cus-test)) + (load custom-test-admin-cus-test) + (should (null (cus-test-opts t)))) + +(ert-deftest custom-test-enable-theme-keeps-settings () + "Test that enabling a theme doesn't change its settings." + (let* ((custom-theme-load-path `(,(ert-resource-directory))) + settings) + (load-theme 'custom--test 'no-confirm 'no-enable) + (setq settings (get 'custom--test 'theme-settings)) + (enable-theme 'custom--test) + (should (equal settings (get 'custom--test 'theme-settings))))) + + (defcustom custom--test-local-option 'initial + "Buffer-local user option for testing." + :group 'emacs + :type '(choice (const initial) (const changed)) + :local t) + + (defcustom custom--test-permanent-option 'initial + "Permanently local user option for testing." + :group 'emacs + :type '(choice (const initial) (const changed)) + :local 'permanent) + + (ert-deftest custom-test-local-option () + "Test :local user options." + ;; Initial default values. + (should (eq custom--test-local-option 'initial)) + (should (eq custom--test-permanent-option 'initial)) + (should (eq (default-value 'custom--test-local-option) 'initial)) + (should (eq (default-value 'custom--test-permanent-option) 'initial)) + (let ((obuf (current-buffer))) + (with-temp-buffer + ;; Changed buffer-local values. + (setq custom--test-local-option 'changed) + (setq custom--test-permanent-option 'changed) + (should (eq custom--test-local-option 'changed)) + (should (eq custom--test-permanent-option 'changed)) + (should (eq (default-value 'custom--test-local-option) 'initial)) + (should (eq (default-value 'custom--test-permanent-option) 'initial)) + (with-current-buffer obuf + (should (eq custom--test-local-option 'initial)) + (should (eq custom--test-permanent-option 'initial))) + ;; Permanent variable remains unchanged. + (kill-all-local-variables) + (should (eq custom--test-local-option 'initial)) + (should (eq custom--test-permanent-option 'changed)) + (should (eq (default-value 'custom--test-local-option) 'initial)) + (should (eq (default-value 'custom--test-permanent-option) 'initial))))) + ;;; custom-tests.el ends here