aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMichael Albinus2024-01-11 12:30:05 +0100
committerMichael Albinus2024-01-11 12:30:05 +0100
commitef08f94cbec1a9fb98bc1bbfcc88cd399b7ff8d0 (patch)
treec99a9bd2976f4f01589ed74043e6c2581e33bfab /test
parentc7aa5c6d2b838e2fd84db4cbdafdbd546dd87832 (diff)
downloademacs-ef08f94cbec1a9fb98bc1bbfcc88cd399b7ff8d0.tar.gz
emacs-ef08f94cbec1a9fb98bc1bbfcc88cd399b7ff8d0.zip
Support numeric port numbers in auth-source-macos-keychain
* lisp/auth-source.el (auth-source-macos-keychain-search): Support numeric port numbers (bug#68376). (auth-source-macos-keychain-search-items): Make regexp more robust. * test/lisp/auth-source-tests.el (test-macos-keychain-search): Extend test.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/auth-source-tests.el28
1 files changed, 18 insertions, 10 deletions
diff --git a/test/lisp/auth-source-tests.el b/test/lisp/auth-source-tests.el
index 5452501b861..2ff76977174 100644
--- a/test/lisp/auth-source-tests.el
+++ b/test/lisp/auth-source-tests.el
@@ -442,18 +442,26 @@ machine c1 port c2 user c3 password c4\n"
442 (cl-letf (((symbol-function 'call-process) 442 (cl-letf (((symbol-function 'call-process)
443 (lambda (_program _infile _destination _display 443 (lambda (_program _infile _destination _display
444 &rest args) 444 &rest args)
445 ;; Arguments must be all strings 445 ;; Arguments must be all strings.
446 (should (cl-every #'stringp args)) 446 (should (cl-every #'stringp args))
447 ;; Argument number should be even 447 ;; Argument number should be even.
448 (should (cl-evenp (length args))) 448 (should (cl-evenp (length args)))
449 (should (cond ((string= (car args) "find-internet-password") 449 (should
450 (let ((protocol (cl-member "-r" args :test #'string=))) 450 (cond
451 (if protocol 451 ((string= (car args) "find-internet-password")
452 (= 4 (length (cadr protocol))) 452 (let ((protocol-r (cl-member "-r" args :test #'string=))
453 t))) 453 (protocol-P (cl-member "-P" args :test #'string=)))
454 ((string= (car args) "find-generic-password") 454 (cond (protocol-r
455 t)))))) 455 (= 4 (length (cadr protocol-r))))
456 (auth-source-search :user '("a" "b") :host '("example.org") :port '("irc" "ftp" "https"))))) 456 (protocol-P
457 (string-match-p
458 "\\`[[:digit:]]+\\'" (cadr protocol-P)))
459 (t))))
460 ((string= (car args) "find-generic-password")
461 t))))))
462 (auth-source-search
463 :user '("a" "b") :host '("example.org")
464 :port '("irc" "ftp" "https" 123)))))
457 465
458(provide 'auth-source-tests) 466(provide 'auth-source-tests)
459;;; auth-source-tests.el ends here 467;;; auth-source-tests.el ends here