1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-30 04:10:54 -08:00

Fix some failing tests in BSD systems

* test/lisp/progmodes/xref-tests.el
(xref--xref-file-name-display-is-abs)
(xref--xref-file-name-display-is-relative-to-project-root):
Accommodate some older versions of BSD find
(https://lists.gnu.org/archive/html/emacs-devel/2021-01/msg00156.html).
This commit is contained in:
Daniel Martín 2021-01-06 22:53:40 +02:00 committed by Dmitry Gutov
parent 665b4e7c4e
commit 331e40a8fd

View file

@ -99,13 +99,18 @@
(should (null (marker-position (cdr (nth 0 (cdr cons2))))))))
(ert-deftest xref--xref-file-name-display-is-abs ()
(let ((xref-file-name-display 'abs))
(should (equal (delete-dups
(mapcar 'xref-location-group
(xref-tests--locations-in-data-dir "\\(bar\\|foo\\)")))
(list
(concat xref-tests--data-dir "file1.txt")
(concat xref-tests--data-dir "file2.txt"))))))
(let ((xref-file-name-display 'abs)
;; Some older BSD find versions can produce '//' in the output.
(expected (list
(concat xref-tests--data-dir "/?file1.txt")
(concat xref-tests--data-dir "/?file2.txt")))
(actual (delete-dups
(mapcar 'xref-location-group
(xref-tests--locations-in-data-dir "\\(bar\\|foo\\)")))))
(should (and (= (length expected) (length actual))
(cl-every (lambda (e1 e2)
(string-match-p e1 e2))
expected actual)))))
(ert-deftest xref--xref-file-name-display-is-nondirectory ()
(let ((xref-file-name-display 'nondirectory))
@ -121,10 +126,15 @@
(file-name-directory (directory-file-name xref-tests--data-dir)))
(project-find-functions
#'(lambda (_) (cons 'transient data-parent-dir)))
(xref-file-name-display 'project-relative))
(should (equal (delete-dups
(mapcar 'xref-location-group
(xref-tests--locations-in-data-dir "\\(bar\\|foo\\)")))
(list
"xref-resources/file1.txt"
"xref-resources/file2.txt")))))
(xref-file-name-display 'project-relative)
;; Some older BSD find versions can produce '//' in the output.
(expected (list
"xref-resources//?file1.txt"
"xref-resources//?file2.txt"))
(actual (delete-dups
(mapcar 'xref-location-group
(xref-tests--locations-in-data-dir "\\(bar\\|foo\\)")))))
(should (and (= (length expected) (length actual))
(cl-every (lambda (e1 e2)
(string-match-p e1 e2))
expected actual)))))