emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 7ae0a24: New test custom--test-theme-variables


From: Michael Albinus
Subject: [Emacs-diffs] master 7ae0a24: New test custom--test-theme-variables
Date: Thu, 10 Jan 2019 07:27:42 -0500 (EST)

branch: master
commit 7ae0a24c87c2bbefe78717d5e89cf3fe14f4af4c
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>

    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.
---
 test/lisp/custom-resources/custom--test-theme.el |  9 ++++++
 test/lisp/custom-tests.el                        | 39 ++++++++++++++++++++++++
 2 files changed, 48 insertions(+)

diff --git a/test/lisp/custom-resources/custom--test-theme.el 
b/test/lisp/custom-resources/custom--test-theme.el
new file mode 100644
index 0000000..da9121e
--- /dev/null
+++ b/test/lisp/custom-resources/custom--test-theme.el
@@ -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)
diff --git a/test/lisp/custom-tests.el b/test/lisp/custom-tests.el
index 16ad7db..0c49db6 100644
--- a/test/lisp/custom-tests.el
+++ b/test/lisp/custom-tests.el
@@ -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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]