summaryrefslogtreecommitdiff
path: root/test/lisp/gnus
diff options
context:
space:
mode:
Diffstat (limited to 'test/lisp/gnus')
-rw-r--r--test/lisp/gnus/auth-source-tests.el45
-rw-r--r--test/lisp/gnus/message-tests.el6
2 files changed, 48 insertions, 3 deletions
diff --git a/test/lisp/gnus/auth-source-tests.el b/test/lisp/gnus/auth-source-tests.el
index 0b49b9013f7..dd70d546d5c 100644
--- a/test/lisp/gnus/auth-source-tests.el
+++ b/test/lisp/gnus/auth-source-tests.el
@@ -174,5 +174,50 @@
(:search-function . auth-source-secrets-search)
(:create-function . auth-source-secrets-create)))))
+(defun auth-source--test-netrc-parse-entry (entry host user port)
+ "Parse a netrc entry from buffer."
+ (auth-source-forget-all-cached)
+ (setq port (auth-source-ensure-strings port))
+ (with-temp-buffer
+ (insert entry)
+ (goto-char (point-min))
+ (let* ((check (lambda(alist)
+ (and alist
+ (auth-source-search-collection
+ host
+ (or
+ (auth-source--aget alist "machine")
+ (auth-source--aget alist "host")
+ t))
+ (auth-source-search-collection
+ user
+ (or
+ (auth-source--aget alist "login")
+ (auth-source--aget alist "account")
+ (auth-source--aget alist "user")
+ t))
+ (auth-source-search-collection
+ port
+ (or
+ (auth-source--aget alist "port")
+ (auth-source--aget alist "protocol")
+ t)))))
+ (entries (auth-source-netrc-parse-entries check 1)))
+ entries)))
+
+(ert-deftest auth-source-test-netrc-parse-entry ()
+ (should (equal (auth-source--test-netrc-parse-entry
+ "machine mymachine1 login user1 password pass1\n" t t t)
+ '((("password" . "pass1")
+ ("login" . "user1")
+ ("machine" . "mymachine1")))))
+ (should (equal (auth-source--test-netrc-parse-entry
+ "machine mymachine1 login user1 password pass1 port 100\n"
+ t t t)
+ '((("port" . "100")
+ ("password" . "pass1")
+ ("login" . "user1")
+ ("machine" . "mymachine1"))))))
+
(provide 'auth-source-tests)
;;; auth-source-tests.el ends here
diff --git a/test/lisp/gnus/message-tests.el b/test/lisp/gnus/message-tests.el
index 49a72b0e67a..790b5c15125 100644
--- a/test/lisp/gnus/message-tests.el
+++ b/test/lisp/gnus/message-tests.el
@@ -40,9 +40,9 @@
"and here's a closer ")
(let ((last-command-event ?\)))
(ert-simulate-command '(self-insert-command 1)))
- ;; Syntax propertization doesn't kick in batch mode
- (when noninteractive
- (syntax-propertize (point-max)))
+ ;; Auto syntax propertization doesn't kick in until
+ ;; parse-sexp-lookup-properties is set.
+ (setq-local parse-sexp-lookup-properties t)
(backward-sexp)
(should (string= "here's an opener "
(buffer-substring-no-properties