Package: emacs
Version: 25.0.50
Severity: minor
X-Debbugs-CC: stephen_leake@stephe-leake.org


Test xref-elisp-test-find-defs-feature-el fails on my Windows system because of a case-sensitive filename comparison.

Basically

ELISP> (aref (aref (car (elisp--xref-find-definitions 'xref)) 2) 3)
"c:/devel/emacs/repo/trunk/lisp/progmodes/xref.el"

ELISP> (aref (xref-make-elisp-location
     'xref 'feature
     (expand-file-name "../../lisp/progmodes/xref.el"
emacs-test-dir))
    3)
"c:/Devel/emacs/repo/trunk/lisp/progmodes/xref.el"

and the test fails at the d/D in c:/Devel vs. c:/devel (as seen in the log below).

The value returned by `expand-file-name' is the real name as stored in the filesystem (the directory is called "Devel"). The value from `elisp--xref-find-definitions' ultimately comes from `locate-file', and reflects what's stored in `load-path' (which can be set by the user, so we cannot force it to have "correct" casing).

ELISP> (locate-file "xref" load-path '(".el"))
"c:/devel/emacs/repo/trunk/lisp/progmodes/xref.el"
ELISP> (locate-file "xref" '("c:/Devel/emacs/repo/trunk/lisp/progmodes") '(".el"))
"c:/Devel/emacs/repo/trunk/lisp/progmodes/xref.el"

The test code in elisp-mode-tests.el uses `equal' to compare the xref structures. I can think a couple of ways to fix the test, but they are all quite ugly....




Test xref-elisp-test-find-defs-feature-el backtrace:
  (if (unwind-protect (setq value-107 (apply fn-105 args-106)) (setq f
  (let (form-description-109) (if (unwind-protect (setq value-107 (app
  (let ((value-107 (quote ert-form-evaluation-aborted-108))) (let (for
  (let ((fn-105 (function equal)) (args-106 (list xref (or (if (consp
  (let ((xref (car-safe (prog1 xrefs (setq xrefs (cdr xrefs))))) (expe
  (while xrefs (let ((xref (car-safe (prog1 xrefs (setq xrefs (cdr xre
  xref-elisp-test-run(([eieio-class-tag--xref-item #("(feature xref)"
  (closure (cl-struct-xref-elisp-root-type-tags t) nil (xref-elisp-tes
  ert--run-test-internal([cl-struct-ert--test-execution-info [cl-struc
  ert-run-test([cl-struct-ert-test xref-elisp-test-find-defs-feature-e
  ert-run-or-rerun-test([cl-struct-ert--stats t [[cl-struct-ert-test e
  ert-run-tests(t #[385 "\306 \307\"\203G \211\211G\310U\203 \211@\20
  ert-run-tests-batch(nil)
  ert-run-tests-batch-and-exit()
  command-line-1(("-l" "ert" "-l" "elisp-mode-tests.el" "-f" "ert-run-
  command-line()
  normal-top-level()
Test xref-elisp-test-find-defs-feature-el condition:
    (ert-test-failed
     ((should
       (equal xref
              (or ... expected)))
      :form
      (equal
       [eieio-class-tag--xref-item
        #("(feature xref)" 1 8 ... 9 13 ...)
        [cl-struct-xref-elisp-location xref feature "c:/devel/emacs/repo/trunk/lisp/progmodes/xref.el"]]
       [eieio-class-tag--xref-item "(feature xref)"
                                   [cl-struct-xref-elisp-location xref feature "c:/Devel/emacs/repo/trunk/lisp/progmodes/xref.el"]])
      :value nil :explanation
      (array-elt 2
                 (array-elt 3
                            (array-elt 3 ...)))))
   FAILED  34/35  xref-elisp-test-find-defs-feature-el
   passed  35/35  xref-elisp-test-find-defs-feature-eval

Ran 35 tests, 34 results as expected, 1 unexpected (2015-11-02 17:11:45+0100)

1 unexpected results:
   FAILED  xref-elisp-test-find-defs-feature-el