Xref test improvements
* test/lisp/progmodes/xref-tests.el (xref--xref-file-name-display-is-abs): Fix not to rely on the default value. (xref-matches-in-files-includes-matches-from-all-the-files): New test.
This commit is contained in:
parent
7e1cfa29c3
commit
05adcefa1f
1 changed files with 21 additions and 12 deletions
|
@ -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))
|
||||
|
|
Loading…
Add table
Reference in a new issue