[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master fcfa239: Fix Bug#21816; case insensitive file syste
From: |
Stephen Leake |
Subject: |
[Emacs-diffs] master fcfa239: Fix Bug#21816; case insensitive file system in elisp-mode-tests.el |
Date: |
Tue, 03 Nov 2015 14:49:48 +0000 |
branch: master
commit fcfa23911dfb530c2fb5cdc81518127853c88f9a
Author: Stephen Leake <address@hidden>
Commit: Stephen Leake <address@hidden>
Fix Bug#21816; case insensitive file system in elisp-mode-tests.el
* test/automated/elisp-mode-tests.el (xref-elisp-test-run): Use
case-insensitive string compare for file names.
(emacs-test-dir): Add 'downcase' to cause case differences (at least on
my system).
---
test/automated/elisp-mode-tests.el | 31 ++++++++++++++++++++++++-------
1 files changed, 24 insertions(+), 7 deletions(-)
diff --git a/test/automated/elisp-mode-tests.el
b/test/automated/elisp-mode-tests.el
index 2f6675a..bd83f1a 100644
--- a/test/automated/elisp-mode-tests.el
+++ b/test/automated/elisp-mode-tests.el
@@ -1,4 +1,4 @@
-;;; elisp-mode-tests.el --- Tests for emacs-lisp-mode -*- lexical-binding: t;
-*-
+d;;; elisp-mode-tests.el --- Tests for emacs-lisp-mode -*- lexical-binding:
t; -*-
;; Copyright (C) 2015 Free Software Foundation, Inc.
@@ -179,15 +179,23 @@
(defun xref-elisp-test-run (xrefs expected-xrefs)
(should (= (length xrefs) (length expected-xrefs)))
(while xrefs
- (let ((xref (pop xrefs))
- (expected (pop expected-xrefs)))
+ (let* ((xref (pop xrefs))
+ (expected (pop expected-xrefs))
+ (expected-xref (or (when (consp expected) (car expected)) expected))
+ (expected-source (when (consp expected) (cdr expected))))
- (should (equal xref
- (or (when (consp expected) (car expected)) expected)))
+ ;; Downcase the filenames for case-insensitive file systems.
+ (setf (xref-elisp-location-file (oref xref location))
+ (downcase (xref-elisp-location-file (oref xref location))))
+
+ (setf (xref-elisp-location-file (oref expected-xref location))
+ (downcase (xref-elisp-location-file (oref expected-xref
location))))
+
+ (should (equal xref expected-xref))
(xref--goto-location (xref-item-location xref))
(back-to-indentation)
- (should (looking-at (or (when (consp expected) (cdr expected))
+ (should (looking-at (or expected-source
(xref-elisp-test-descr-to-target expected)))))
))
@@ -207,7 +215,16 @@ to (xref-elisp-test-descr-to-target xref)."
;; so we must provide this dir to expand-file-name in the expected
;; results. This also allows running these tests from other
;; directories.
-(defconst emacs-test-dir (file-name-directory (or load-file-name
(buffer-file-name))))
+;;
+;; We add 'downcase' here to deliberately cause a potential problem on
+;; case-insensitive file systems. On such systems, `load-file-name'
+;; may not have the same case as the real file system, since the user
+;; can set `load-path' to have the wrong case (on my Windows system,
+;; `load-path' has the correct case, so this causes the expected test
+;; values to have the wrong case). This is handled in
+;; `xref-elisp-test-run'.
+(defconst emacs-test-dir (downcase (file-name-directory (or load-file-name
(buffer-file-name)))))
+
;; alphabetical by test name
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master fcfa239: Fix Bug#21816; case insensitive file system in elisp-mode-tests.el,
Stephen Leake <=