mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-21 05:00:47 -08:00
Restrict downcasing in elisp xref tests (bug#25534)
The tests happen to not fail at the moment because find-library-name now has an extra feature, find-library--from-load-history, which happens to do a case-insensitive regexp match; but still it seems better not to rely on this. * test/lisp/progmodes/elisp-mode-tests.el (xref--case-insensitive): New variable. (xref-elisp-test-run, emacs-test-dir): Only downcase if the filesystem seems to be case-insensitive.
This commit is contained in:
parent
ab8ed41859
commit
4c6c327d0c
1 changed files with 20 additions and 8 deletions
|
|
@ -298,6 +298,16 @@
|
||||||
)))
|
)))
|
||||||
|
|
||||||
|
|
||||||
|
;; tmp may be on a different filesystem to the tests, but, ehh.
|
||||||
|
(defvar xref--case-insensitive
|
||||||
|
(let ((dir (make-temp-file "xref-test" t)))
|
||||||
|
(unwind-protect
|
||||||
|
(progn
|
||||||
|
(with-temp-file (expand-file-name "hElLo" dir) "hello")
|
||||||
|
(file-exists-p (expand-file-name "HELLO" dir)))
|
||||||
|
(delete-directory dir t)))
|
||||||
|
"Non-nil if file system seems to be case-insensitive.")
|
||||||
|
|
||||||
(defun xref-elisp-test-run (xrefs expected-xrefs)
|
(defun xref-elisp-test-run (xrefs expected-xrefs)
|
||||||
(should (= (length xrefs) (length expected-xrefs)))
|
(should (= (length xrefs) (length expected-xrefs)))
|
||||||
(while xrefs
|
(while xrefs
|
||||||
|
|
@ -307,11 +317,13 @@
|
||||||
(expected-source (when (consp expected) (cdr expected))))
|
(expected-source (when (consp expected) (cdr expected))))
|
||||||
|
|
||||||
;; Downcase the filenames for case-insensitive file systems.
|
;; Downcase the filenames for case-insensitive file systems.
|
||||||
|
(when xref--case-insensitive
|
||||||
(setf (xref-elisp-location-file (oref xref location))
|
(setf (xref-elisp-location-file (oref xref location))
|
||||||
(downcase (xref-elisp-location-file (oref xref location))))
|
(downcase (xref-elisp-location-file (oref xref location))))
|
||||||
|
|
||||||
(setf (xref-elisp-location-file (oref expected-xref location))
|
(setf (xref-elisp-location-file (oref expected-xref location))
|
||||||
(downcase (xref-elisp-location-file (oref expected-xref location))))
|
(downcase (xref-elisp-location-file
|
||||||
|
(oref expected-xref location)))))
|
||||||
|
|
||||||
(should (equal xref expected-xref))
|
(should (equal xref expected-xref))
|
||||||
|
|
||||||
|
|
@ -346,8 +358,8 @@ to (xref-elisp-test-descr-to-target xref)."
|
||||||
;; `load-path' has the correct case, so this causes the expected test
|
;; `load-path' has the correct case, so this causes the expected test
|
||||||
;; values to have the wrong case). This is handled in
|
;; values to have the wrong case). This is handled in
|
||||||
;; `xref-elisp-test-run'.
|
;; `xref-elisp-test-run'.
|
||||||
(defconst emacs-test-dir
|
(defvar emacs-test-dir
|
||||||
(downcase
|
(funcall (if xref--case-insensitive 'downcase 'identity)
|
||||||
(file-truename (file-name-directory
|
(file-truename (file-name-directory
|
||||||
(or load-file-name (buffer-file-name))))))
|
(or load-file-name (buffer-file-name))))))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue