aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorEli Zaretskii2022-12-10 13:22:48 +0200
committerEli Zaretskii2022-12-10 13:22:48 +0200
commitd3494f1bded55a3dce3dcaee1e10a76b7b8765f4 (patch)
treeb7df895d605ce45027167cb7f2800c3163d787b5 /test
parent3785fe52e4692ffef14c0a1e50361c22d66fabe8 (diff)
downloademacs-d3494f1bded55a3dce3dcaee1e10a76b7b8765f4.tar.gz
emacs-d3494f1bded55a3dce3dcaee1e10a76b7b8765f4.zip
Resurrect changes omitted by a recent merge from emacs-29 (bug#59921)
This includes the changes for the following commits: 670daa8b b429e524 c83c95634e7 6479691cf07 b710ca62c00 d31a2539834 a669d5fae54 f7262b8f81e fef17557365 bf81df86e52 bfc00f1c120 d2411615e8b dcf69a1d
Diffstat (limited to 'test')
-rw-r--r--test/lisp/auth-source-pass-tests.el31
-rw-r--r--test/lisp/comint-tests.el16
-rw-r--r--test/src/sqlite-tests.el1
-rw-r--r--test/src/treesit-tests.el8
4 files changed, 40 insertions, 16 deletions
diff --git a/test/lisp/auth-source-pass-tests.el b/test/lisp/auth-source-pass-tests.el
index 1107e09b51b..d6d42ce942e 100644
--- a/test/lisp/auth-source-pass-tests.el
+++ b/test/lisp/auth-source-pass-tests.el
@@ -175,7 +175,8 @@ HOSTNAME, USER and PORT are passed unchanged to
175(ert-deftest auth-source-pass-any-host () 175(ert-deftest auth-source-pass-any-host ()
176 (auth-source-pass--with-store '(("foo" ("port" . "foo-port") ("host" . "foo-user")) 176 (auth-source-pass--with-store '(("foo" ("port" . "foo-port") ("host" . "foo-user"))
177 ("bar")) 177 ("bar"))
178 (should-not (auth-source-pass-search :host t)))) 178 (let ((inhibit-message t)) ; silence "... does not handle host wildcards."
179 (should-not (auth-source-pass-search :host t)))))
179 180
180(ert-deftest auth-source-pass-undefined-host () 181(ert-deftest auth-source-pass-undefined-host ()
181 (auth-source-pass--with-store '(("foo" ("port" . "foo-port") ("host" . "foo-user")) 182 (auth-source-pass--with-store '(("foo" ("port" . "foo-port") ("host" . "foo-user"))
@@ -697,29 +698,29 @@ machine Libera.Chat password b
697;; with slightly more realistic and less legible values. 698;; with slightly more realistic and less legible values.
698 699
699(ert-deftest auth-source-pass-extra-query-keywords--suffixed-user () 700(ert-deftest auth-source-pass-extra-query-keywords--suffixed-user ()
700 (let ((store (sort (copy-sequence '(("x.com:42/b@r" (secret . "a")) 701 (let ((store (sort (copy-sequence '(("x.com:42/s p@m" (secret . "a"))
701 ("b@r@x.com" (secret . "b")) 702 ("s p@m@x.com" (secret . "b"))
702 ("x.com" (secret . "?")) 703 ("x.com" (secret . "?"))
703 ("b@r@y.org" (secret . "c")) 704 ("s p@m@y.org" (secret . "c"))
704 ("fake.com" (secret . "?")) 705 ("fa ke" (secret . "?"))
705 ("fake.com/b@r" (secret . "d")) 706 ("fa ke/s p@m" (secret . "d"))
706 ("y.org/b@r" (secret . "?")) 707 ("y.org/s p@m" (secret . "?"))
707 ("b@r@fake.com" (secret . "e")))) 708 ("s p@m@fa ke" (secret . "e"))))
708 (lambda (&rest _) (zerop (random 2)))))) 709 (lambda (&rest _) (zerop (random 2))))))
709 (auth-source-pass--with-store store 710 (auth-source-pass--with-store store
710 (auth-source-pass-enable) 711 (auth-source-pass-enable)
711 (let* ((auth-source-pass-extra-query-keywords t) 712 (let* ((auth-source-pass-extra-query-keywords t)
712 (results (auth-source-search :host '("x.com" "fake.com" "y.org") 713 (results (auth-source-search :host '("x.com" "fa ke" "y.org")
713 :user "b@r" 714 :user "s p@m"
714 :require '(:user) :max 5))) 715 :require '(:user) :max 5)))
715 (dolist (result results) 716 (dolist (result results)
716 (setf (plist-get result :secret) (auth-info-password result))) 717 (setf (plist-get result :secret) (auth-info-password result)))
717 (should (equal results 718 (should (equal results
718 '((:host "x.com" :user "b@r" :secret "b") 719 '((:host "x.com" :user "s p@m" :secret "b")
719 (:host "x.com" :user "b@r" :port "42" :secret "a") 720 (:host "x.com" :user "s p@m" :port "42" :secret "a")
720 (:host "fake.com" :user "b@r" :secret "e") 721 (:host "fa ke" :user "s p@m" :secret "e")
721 (:host "fake.com" :user "b@r" :secret "d") 722 (:host "fa ke" :user "s p@m" :secret "d")
722 (:host "y.org" :user "b@r" :secret "c")))))))) 723 (:host "y.org" :user "s p@m" :secret "c"))))))))
723 724
724;; This is a more distilled version of `suffixed-user', above. It 725;; This is a more distilled version of `suffixed-user', above. It
725;; better illustrates that search order takes precedence over "/user" 726;; better illustrates that search order takes precedence over "/user"
diff --git a/test/lisp/comint-tests.el b/test/lisp/comint-tests.el
index 8402c13daf3..ce1a6865b65 100644
--- a/test/lisp/comint-tests.el
+++ b/test/lisp/comint-tests.el
@@ -59,9 +59,23 @@
59 (dolist (str comint-testsuite-password-strings) 59 (dolist (str comint-testsuite-password-strings)
60 (should (string-match comint-password-prompt-regexp str)))) 60 (should (string-match comint-password-prompt-regexp str))))
61 61
62(declare-function w32-application-type "w32proc.c")
63(defun w32-native-executable-p (fname)
64 "Predicate to test program FNAME for being a native Windows application."
65 (and (memq (w32-application-type fname) '(w32-native dos))
66 (file-executable-p fname)))
67
68(defun w32-native-executable-find (name)
69 "Find a native MS-Windows application named NAME.
70This is needed to avoid invoking MSYS or Cygwin executables that
71happen to lurk on PATH when running the test suite."
72 (locate-file name exec-path exec-suffixes 'w32-native-executable-p))
73
62(defun comint-tests/test-password-function (password-function) 74(defun comint-tests/test-password-function (password-function)
63 "PASSWORD-FUNCTION can return nil or a string." 75 "PASSWORD-FUNCTION can return nil or a string."
64 (when-let ((cat (executable-find "cat"))) 76 (when-let ((cat (if (eq system-type 'windows-nt)
77 (w32-native-executable-find "cat")
78 (executable-find "cat"))))
65 (let ((comint-password-function password-function)) 79 (let ((comint-password-function password-function))
66 (cl-letf (((symbol-function 'read-passwd) 80 (cl-letf (((symbol-function 'read-passwd)
67 (lambda (&rest _args) "non-nil"))) 81 (lambda (&rest _args) "non-nil")))
diff --git a/test/src/sqlite-tests.el b/test/src/sqlite-tests.el
index e9ddf9c0bef..a2472c43dad 100644
--- a/test/src/sqlite-tests.el
+++ b/test/src/sqlite-tests.el
@@ -36,6 +36,7 @@
36(declare-function sqlite-select "sqlite.c") 36(declare-function sqlite-select "sqlite.c")
37(declare-function sqlite-open "sqlite.c") 37(declare-function sqlite-open "sqlite.c")
38(declare-function sqlite-load-extension "sqlite.c") 38(declare-function sqlite-load-extension "sqlite.c")
39(declare-function sqlite-version "sqlite.c")
39 40
40(ert-deftest sqlite-select () 41(ert-deftest sqlite-select ()
41 (skip-unless (sqlite-available-p)) 42 (skip-unless (sqlite-available-p))
diff --git a/test/src/treesit-tests.el b/test/src/treesit-tests.el
index 80fde408cd3..aba12759c34 100644
--- a/test/src/treesit-tests.el
+++ b/test/src/treesit-tests.el
@@ -143,6 +143,8 @@
143 (treesit-node-string 143 (treesit-node-string
144 (treesit-node-first-child-for-pos 144 (treesit-node-first-child-for-pos
145 doc-node 3)))) 145 doc-node 3))))
146 (should-error (treesit-node-first-child-for-pos doc-node 100)
147 :type 'args-out-of-range)
146 ;; `treesit-node-descendant-for-range'. 148 ;; `treesit-node-descendant-for-range'.
147 (should (equal "(\"{\")" 149 (should (equal "(\"{\")"
148 (treesit-node-string 150 (treesit-node-string
@@ -152,6 +154,9 @@
152 (treesit-node-string 154 (treesit-node-string
153 (treesit-node-descendant-for-range 155 (treesit-node-descendant-for-range
154 root-node 6 7 t)))) 156 root-node 6 7 t))))
157 (should-error (treesit-node-descendant-for-range
158 root-node 100 101)
159 :type 'args-out-of-range)
155 ;; `treesit-node-eq'. 160 ;; `treesit-node-eq'.
156 (should (treesit-node-eq root-node root-node)) 161 (should (treesit-node-eq root-node root-node))
157 (should (not (treesit-node-eq root-node doc-node)))))) 162 (should (not (treesit-node-eq root-node doc-node))))))
@@ -167,6 +172,9 @@
167 (setq root-node (treesit-parser-root-node 172 (setq root-node (treesit-parser-root-node
168 parser))) 173 parser)))
169 174
175 (should-error (treesit-query-capture root-node "" 100 101)
176 :type 'args-out-of-range)
177
170 ;; Test `treesit-query-capture' on string, sexp and compiled 178 ;; Test `treesit-query-capture' on string, sexp and compiled
171 ;; queries. 179 ;; queries.
172 (dolist (query1 180 (dolist (query1