diff options
| author | Daniel Mendler <mail@daniel-mendler.de> | 2023-01-16 15:33:05 +0100 |
|---|---|---|
| committer | Daniel Mendler <mail@daniel-mendler.de> | 2023-01-16 15:34:39 +0100 |
| commit | f7acde710a1e0e610f1063a38817a91be74ed848 (patch) | |
| tree | a457d2a469ca094bbb1b1557d809800a5878c9be | |
| parent | 04666aacc7e5d435be5359066e2bdc82b8e88eef (diff) | |
compat-tests: Do not load modes
| -rw-r--r-- | compat-tests.el | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/compat-tests.el b/compat-tests.el index 8ba2819..169fc35 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 () |
