branch: scratch/editorconfig-cc commit 33ab2b6485c9b718d966149b9c0c9a41998a29ae Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier <monn...@iro.umontreal.ca>
Add ert-test for file_type_ext --- ert-tests/editorconfig.el | 20 ++++++++++++++++++++ ert-tests/test_files_secondary/.editorconfig | 7 +++++++ 2 files changed, 27 insertions(+) diff --git a/ert-tests/editorconfig.el b/ert-tests/editorconfig.el index b45b87b503..b9d795fd2d 100644 --- a/ert-tests/editorconfig.el +++ b/ert-tests/editorconfig.el @@ -1,3 +1,11 @@ +(defun display-warning (type message &optional level buffer-name) + "When testing overwrite this function to throw error when called." + (error "display-warning called: %S %S %S %S" + type + message + level + buffer-name)) + (defmacro with-visit-file (path &rest body) "Visit PATH and evaluate BODY." (declare (indent 1) (debug t)) @@ -72,3 +80,15 @@ "c.txt") (should (eq major-mode 'conf-unix-mode))) (editorconfig-mode -1)) + +(ert-deftest test-file-type-ext nil + (editorconfig-mode 1) + (with-visit-file (concat editorconfig-secondary-ert-dir + "a.txt") + (should (eq major-mode 'conf-unix-mode))) + + (with-visit-file (concat editorconfig-secondary-ert-dir + "bin/perlscript") + (should (eq major-mode 'perl-mode)) + (should (eq perl-indent-level 5))) + (editorconfig-mode -1)) diff --git a/ert-tests/test_files_secondary/.editorconfig b/ert-tests/test_files_secondary/.editorconfig index eeb02d621a..7f10833f8e 100644 --- a/ert-tests/test_files_secondary/.editorconfig +++ b/ert-tests/test_files_secondary/.editorconfig @@ -6,3 +6,10 @@ indent_style = tab [c.txt] file_type_emacs = conf + +[a.txt] +file_type_ext = ini + +[/bin/*] +file_type_ext = pl +indent_size = 5