emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/compat f7acde710a 2/3: compat-tests: Do not load modes


From: ELPA Syncer
Subject: [elpa] externals/compat f7acde710a 2/3: compat-tests: Do not load modes
Date: Mon, 16 Jan 2023 09:57:25 -0500 (EST)

branch: externals/compat
commit f7acde710a1e0e610f1063a38817a91be74ed848
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    compat-tests: Do not load modes
---
 compat-tests.el | 34 ++++++++++++++++++++--------------
 1 file changed, 20 insertions(+), 14 deletions(-)

diff --git a/compat-tests.el b/compat-tests.el
index 8ba281960d..169fc35948 100644
--- a/compat-tests.el
+++ b/compat-tests.el
@@ -81,31 +81,37 @@
     (should (eq (compat-call plist-get list "first" #'string=) 1))))
 
 (ert-deftest buffer-match-p ()
-  (with-current-buffer (get-buffer-create "*compat-test-buffer*")
-    (js-mode))
-  (let ((b "*compat-test-buffer*"))
+  (let ((b "*compat-test-buffer*")
+        (child-mode (make-symbol "child"))
+        (parent-mode (make-symbol "parent")))
+    (put child-mode 'derived-mode-parent parent-mode)
+    (with-current-buffer (get-buffer-create b)
+      (setq major-mode child-mode))
     (should (buffer-match-p t b))
     (should-not (buffer-match-p nil b))
     (should (buffer-match-p "compat" b))
     (should (buffer-match-p #'always b))
     (should-not (buffer-match-p #'ignore b))
-    (should (buffer-match-p '(derived-mode . prog-mode) b))
+    (should (buffer-match-p `(derived-mode . ,parent-mode) b))
     (should-not (buffer-match-p '(derived-mode . text-mode) b))
-    (should (buffer-match-p '(major-mode . js-mode) b))
+    (should (buffer-match-p `(major-mode . ,child-mode) b))
     (should-not (buffer-match-p '(major-mode . prog-mode) b))
     (should (buffer-match-p '(not (major-mode . prog-mode)) b))
-    (should (buffer-match-p '(and (major-mode . js-mode) "compat" t) b))
-    (should (buffer-match-p '(or (major-mode . css-mode) "foo" t) b))))
+    (should (buffer-match-p `(and (major-mode . ,child-mode) "compat" t) b))
+    (should (buffer-match-p `(or (major-mode . prog-mode) "foo" t) b))))
 
 (ert-deftest match-buffers ()
-  (let ((b1 (get-buffer-create "*compat-buffer-js*"))
-        (b2 (get-buffer-create "*compat-buffer-css*"))
-        (b3 (get-buffer-create "*compat-buffer-text*")))
-  (with-current-buffer b1 (js-mode))
-  (with-current-buffer b2 (css-mode))
-  (with-current-buffer b3 (text-mode))
+  (let ((b1 (get-buffer-create "*compat-buffer1*"))
+        (b2 (get-buffer-create "*compat-buffer2*"))
+        (b3 (get-buffer-create "*compat-buffer3*"))
+        (m1 (make-symbol "mode1"))
+        (m2 (make-symbol "mode2"))
+        (m3 (make-symbol "mode3")))
+  (with-current-buffer b1 (setq major-mode m1))
+  (with-current-buffer b2 (setq major-mode m2))
+  (with-current-buffer b3 (setq major-mode m3))
   (should-equal (list b2 b1)
-                (match-buffers '(or (major-mode . css-mode) (major-mode . 
js-mode))
+                (match-buffers `(or (major-mode . ,m1) (major-mode . ,m2))
                                (list b1 b2 b3)))))
 
 (ert-deftest thing-at-mouse ()



reply via email to

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