Skip to content

Commit

Permalink
ntlm-tests: Skip tests if dependencies are too old
Browse files Browse the repository at this point in the history
* test/lisp/net/ntlm-tests.el (ntlm-tests--dependencies-present):
Add version and functionality checks.

Co-authored-by: Michael Albinus <michael.albinus@gmx.de>
  • Loading branch information
fitzsim and albinus committed Feb 19, 2021
1 parent 283f983 commit ade9c22
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion test/lisp/net/ntlm-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,25 @@ ARGUMENTS are passed to it."
(concat "HTTP/1.1 200 OK\n\nAuthenticated." (unibyte-string 13) "\n")
"Expected result of successful NTLM authentication.")

(require 'find-func)
(defun ntlm-tests--ensure-ws-parse-ntlm-support ()
"Ensure NTLM special-case in `ws-parse'."
(let* ((hit (find-function-search-for-symbol
'ws-parse nil (locate-file "web-server.el" load-path)))
(buffer (car hit))
(position (cdr hit)))
(with-current-buffer buffer
(goto-char position)
(search-forward-regexp
":NTLM" (save-excursion (forward-sexp) (point)) t))))

(require 'lisp-mnt)
(defvar ntlm-tests--dependencies-present
(and (featurep 'url-http-ntlm) (featurep 'web-server))
(and (featurep 'url-http-ntlm)
(version<= "2.0.4"
(lm-version (locate-file "url-http-ntlm.el" load-path)))
(featurep 'web-server)
(ntlm-tests--ensure-ws-parse-ntlm-support))
"Non-nil if GNU ELPA test dependencies were loaded.")

(when (not ntlm-tests--dependencies-present)
Expand Down

0 comments on commit ade9c22

Please sign in to comment.