diff options
| author | Stefan Kangas | 2024-12-22 02:57:45 +0100 |
|---|---|---|
| committer | Stefan Kangas | 2024-12-22 03:00:31 +0100 |
| commit | 86a8b24bdea52a7aab45abcc51db2dd47308c11f (patch) | |
| tree | 1277bcafa35a1152a09a71f1bb6fefdd536c9f99 /test | |
| parent | d89d8715eeae775305d4c5790b60793e3e57a474 (diff) | |
| download | emacs-86a8b24bdea52a7aab45abcc51db2dd47308c11f.tar.gz emacs-86a8b24bdea52a7aab45abcc51db2dd47308c11f.zip | |
Match more gdbinit files in auto-mode-alist
* lisp/files.el (auto-mode-alist): Match more gdbinit files,
including XDG, and MS-Windows. Avoid false positives.
(set-auto-mode--find-matching-alist-entry): Break out function...
(set-auto-mode--apply-alist): ...from here. (Bug#74946)
* test/lisp/files-tests.el (files-tests--check-mode): New function.
(files-tests-auto-mode-alist): New test.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/files-tests.el | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el index ad54addf06b..78fc139025c 100644 --- a/test/lisp/files-tests.el +++ b/test/lisp/files-tests.el | |||
| @@ -1661,6 +1661,27 @@ The door of all subtleties! | |||
| 1661 | 1661 | ||
| 1662 | (defvar sh-shell) | 1662 | (defvar sh-shell) |
| 1663 | 1663 | ||
| 1664 | (defun files-tests--check-mode (filename) | ||
| 1665 | "Return the major mode found in `auto-mode-alist' for FILENAME." | ||
| 1666 | (set-auto-mode--find-matching-alist-entry | ||
| 1667 | auto-mode-alist | ||
| 1668 | (concat "/home/jrhacker/" filename) | ||
| 1669 | nil)) | ||
| 1670 | |||
| 1671 | (ert-deftest files-tests-auto-mode-alist () | ||
| 1672 | (should (eq (files-tests--check-mode ".gdbinit.in") #'gdb-script-mode)) | ||
| 1673 | (should (eq (files-tests--check-mode ".gdbinit") #'gdb-script-mode)) | ||
| 1674 | (should (eq (files-tests--check-mode "_gdbinit") #'gdb-script-mode)) ; for MS-DOS | ||
| 1675 | (should (eq (files-tests--check-mode "gdb.ini") #'gdb-script-mode)) ; likewise | ||
| 1676 | (should (eq (files-tests--check-mode "gdbinit") #'gdb-script-mode)) | ||
| 1677 | (should (eq (files-tests--check-mode "gdbinit.in") #'gdb-script-mode)) | ||
| 1678 | (should (eq (files-tests--check-mode "SOMETHING-gdbinit") #'gdb-script-mode)) | ||
| 1679 | (should (eq (files-tests--check-mode ".gdbinit.loader") #'gdb-script-mode)) | ||
| 1680 | (should-not (eq (files-tests--check-mode "gdbinit-history.exp") #'gdb-script-mode)) | ||
| 1681 | (should-not (eq (files-tests--check-mode "gdbinit.c") #'gdb-script-mode)) | ||
| 1682 | (should-not (eq (files-tests--check-mode "gdbinit.5") #'gdb-script-mode)) | ||
| 1683 | (should-not (eq (files-tests--check-mode ".gdbinit.py.in") #'gdb-script-mode))) | ||
| 1684 | |||
| 1664 | (defun files-tests--check-shebang (shebang expected-mode &optional expected-dialect) | 1685 | (defun files-tests--check-shebang (shebang expected-mode &optional expected-dialect) |
| 1665 | "Assert that mode for SHEBANG derives from EXPECTED-MODE. | 1686 | "Assert that mode for SHEBANG derives from EXPECTED-MODE. |
| 1666 | 1687 | ||