diff options
| author | Stephen Leake | 2015-11-03 08:37:53 -0600 |
|---|---|---|
| committer | Stephen Leake | 2015-11-03 08:48:54 -0600 |
| commit | fcfa23911dfb530c2fb5cdc81518127853c88f9a (patch) | |
| tree | 43bde7134283cc47ed086cf2417103702a05e970 /test | |
| parent | 7ad183d8905e7b15690b98d67ae0ae22d873bfa8 (diff) | |
| download | emacs-fcfa23911dfb530c2fb5cdc81518127853c88f9a.tar.gz emacs-fcfa23911dfb530c2fb5cdc81518127853c88f9a.zip | |
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).
Diffstat (limited to 'test')
| -rw-r--r-- | 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 2f6675a2804..bd83f1af435 100644 --- a/test/automated/elisp-mode-tests.el +++ b/test/automated/elisp-mode-tests.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;;; elisp-mode-tests.el --- Tests for emacs-lisp-mode -*- lexical-binding: t; -*- | 1 | d;;; elisp-mode-tests.el --- Tests for emacs-lisp-mode -*- lexical-binding: t; -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2015 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2015 Free Software Foundation, Inc. |
| 4 | 4 | ||
| @@ -179,15 +179,23 @@ | |||
| 179 | (defun xref-elisp-test-run (xrefs expected-xrefs) | 179 | (defun xref-elisp-test-run (xrefs expected-xrefs) |
| 180 | (should (= (length xrefs) (length expected-xrefs))) | 180 | (should (= (length xrefs) (length expected-xrefs))) |
| 181 | (while xrefs | 181 | (while xrefs |
| 182 | (let ((xref (pop xrefs)) | 182 | (let* ((xref (pop xrefs)) |
| 183 | (expected (pop expected-xrefs))) | 183 | (expected (pop expected-xrefs)) |
| 184 | (expected-xref (or (when (consp expected) (car expected)) expected)) | ||
| 185 | (expected-source (when (consp expected) (cdr expected)))) | ||
| 184 | 186 | ||
| 185 | (should (equal xref | 187 | ;; Downcase the filenames for case-insensitive file systems. |
| 186 | (or (when (consp expected) (car expected)) expected))) | 188 | (setf (xref-elisp-location-file (oref xref location)) |
| 189 | (downcase (xref-elisp-location-file (oref xref location)))) | ||
| 190 | |||
| 191 | (setf (xref-elisp-location-file (oref expected-xref location)) | ||
| 192 | (downcase (xref-elisp-location-file (oref expected-xref location)))) | ||
| 193 | |||
| 194 | (should (equal xref expected-xref)) | ||
| 187 | 195 | ||
| 188 | (xref--goto-location (xref-item-location xref)) | 196 | (xref--goto-location (xref-item-location xref)) |
| 189 | (back-to-indentation) | 197 | (back-to-indentation) |
| 190 | (should (looking-at (or (when (consp expected) (cdr expected)) | 198 | (should (looking-at (or expected-source |
| 191 | (xref-elisp-test-descr-to-target expected))))) | 199 | (xref-elisp-test-descr-to-target expected))))) |
| 192 | )) | 200 | )) |
| 193 | 201 | ||
| @@ -207,7 +215,16 @@ to (xref-elisp-test-descr-to-target xref)." | |||
| 207 | ;; so we must provide this dir to expand-file-name in the expected | 215 | ;; so we must provide this dir to expand-file-name in the expected |
| 208 | ;; results. This also allows running these tests from other | 216 | ;; results. This also allows running these tests from other |
| 209 | ;; directories. | 217 | ;; directories. |
| 210 | (defconst emacs-test-dir (file-name-directory (or load-file-name (buffer-file-name)))) | 218 | ;; |
| 219 | ;; We add 'downcase' here to deliberately cause a potential problem on | ||
| 220 | ;; case-insensitive file systems. On such systems, `load-file-name' | ||
| 221 | ;; may not have the same case as the real file system, since the user | ||
| 222 | ;; can set `load-path' to have the wrong case (on my Windows system, | ||
| 223 | ;; `load-path' has the correct case, so this causes the expected test | ||
| 224 | ;; values to have the wrong case). This is handled in | ||
| 225 | ;; `xref-elisp-test-run'. | ||
| 226 | (defconst emacs-test-dir (downcase (file-name-directory (or load-file-name (buffer-file-name))))) | ||
| 227 | |||
| 211 | 228 | ||
| 212 | ;; alphabetical by test name | 229 | ;; alphabetical by test name |
| 213 | 230 | ||