diff options
| author | Dmitry Gutov | 2015-05-05 15:11:14 +0300 |
|---|---|---|
| committer | Dmitry Gutov | 2015-05-05 15:11:14 +0300 |
| commit | fbe7fb054755b9bfe1375691d3c774cb84236859 (patch) | |
| tree | 617eae11afd598eb56df23620bf9666215cf1b7f /test | |
| parent | 6337f2434e3385d4d35240789cdcc9037be7bd01 (diff) | |
| download | emacs-fbe7fb054755b9bfe1375691d3c774cb84236859.tar.gz emacs-fbe7fb054755b9bfe1375691d3c774cb84236859.zip | |
Only skip some variables that have function counterparts
* lisp/progmodes/elisp-mode.el (elisp--xref-identifier-location):
Only skip minor-mode-named variable if it's defined in a Lisp
file, and it's in minor-mode-list (bug#20506).
* test/automated/elisp-mode-tests.el
(elisp-xref-finds-both-function-and-variable)
(elisp-xref-finds-only-function-for-minor-mode): New tests.
Diffstat (limited to 'test')
| -rw-r--r-- | test/automated/elisp-mode-tests.el | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/automated/elisp-mode-tests.el b/test/automated/elisp-mode-tests.el index bfecfe7dc6b..7af6dfcdc03 100644 --- a/test/automated/elisp-mode-tests.el +++ b/test/automated/elisp-mode-tests.el | |||
| @@ -22,6 +22,9 @@ | |||
| 22 | ;;; Code: | 22 | ;;; Code: |
| 23 | 23 | ||
| 24 | (require 'ert) | 24 | (require 'ert) |
| 25 | (require 'xref) | ||
| 26 | |||
| 27 | ;;; Completion | ||
| 25 | 28 | ||
| 26 | (defun elisp--test-completions () | 29 | (defun elisp--test-completions () |
| 27 | (let ((data (elisp-completion-at-point))) | 30 | (let ((data (elisp-completion-at-point))) |
| @@ -101,5 +104,26 @@ | |||
| 101 | (should (member "backup-buffer" comps)) | 104 | (should (member "backup-buffer" comps)) |
| 102 | (should-not (member "backup-inhibited" comps))))) | 105 | (should-not (member "backup-inhibited" comps))))) |
| 103 | 106 | ||
| 107 | ;;; Navigation | ||
| 108 | |||
| 109 | (ert-deftest elisp-xref-finds-both-function-and-variable () | ||
| 110 | ;; "system-name" is both: a variable and a function | ||
| 111 | (let ((defs (elisp-xref-find 'definitions "system-name"))) | ||
| 112 | (should (= (length defs) 2)) | ||
| 113 | (should (string= (xref--xref-description (nth 0 defs)) | ||
| 114 | "(defun system-name)")) | ||
| 115 | (should (string= (xref--xref-description (nth 1 defs)) | ||
| 116 | "(defvar system-name)"))) | ||
| 117 | ;; It's a minor mode, but the variable is defined in buffer.c | ||
| 118 | (let ((defs (elisp-xref-find 'definitions "abbrev-mode"))) | ||
| 119 | (should (= (length defs) 2)))) | ||
| 120 | |||
| 121 | (ert-deftest elisp-xref-finds-only-function-for-minor-mode () | ||
| 122 | ;; Both variable and function are defined in the same place. | ||
| 123 | (let ((defs (elisp-xref-find 'definitions "visible-mode"))) | ||
| 124 | (should (= (length defs) 1)) | ||
| 125 | (should (string= (xref--xref-description (nth 0 defs)) | ||
| 126 | "(defun visible-mode)")))) | ||
| 127 | |||
| 104 | (provide 'elisp-mode-tests) | 128 | (provide 'elisp-mode-tests) |
| 105 | ;;; elisp-mode-tests.el ends here | 129 | ;;; elisp-mode-tests.el ends here |