diff options
-rw-r--r-- | test/lisp/progmodes/xref-tests.el | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/test/lisp/progmodes/xref-tests.el b/test/lisp/progmodes/xref-tests.el index b4b5e4db5d6..028c43db43e 100644 --- a/test/lisp/progmodes/xref-tests.el +++ b/test/lisp/progmodes/xref-tests.el @@ -69,6 +69,15 @@ (should (equal 1 (xref-location-line (nth 0 locs)))) (should (equal 0 (xref-location-column (nth 0 locs)))))) +(ert-deftest xref-matches-in-files-includes-matches-from-all-the-files () + (let ((matches (xref-matches-in-files "bar" + (directory-files xref-tests--data-dir t + "\\`[^.]")))) + (should (= 2 (length matches))) + (should (cl-every + (lambda (match) (equal (xref-item-summary match) "bar")) + matches)))) + (ert-deftest xref--buf-pairs-iterator-groups-markers-by-buffers-1 () (let* ((xrefs (xref-tests--matches-in-data-dir "foo")) (iter (xref--buf-pairs-iterator xrefs)) @@ -99,18 +108,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) - ;; 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))))) + (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 (= (length expected) (length actual))) + (should (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)) |