branch: scratch/editorconfig-cc
commit a38a4f211148564c015cd16d780cf1e4baa39ea4
Author: Jay Kamat <[email protected]>
Commit: Stefan Monnier <[email protected]>
Add tests for lisp-indent-offset ignore
---
ert-tests/editorconfig.el | 27 +++++++++++++++++++++++++++
ert-tests/test_files_secondary/.editorconfig | 5 +++++
ert-tests/test_files_secondary/2_space.el | 1 +
3 files changed, 33 insertions(+)
diff --git a/ert-tests/editorconfig.el b/ert-tests/editorconfig.el
index 11b7895c88..4aebde67cf 100644
--- a/ert-tests/editorconfig.el
+++ b/ert-tests/editorconfig.el
@@ -10,6 +10,10 @@
(concat default-directory
"ert-tests/plugin-tests/test_files/"))
+(defvar editorconfig-secondary-ert-dir
+ (concat default-directory
+ "ert-tests/test_files_secondary/"))
+
(ert-deftest test-editorconfig nil
"Check if properties are applied."
(editorconfig-mode 1)
@@ -25,3 +29,26 @@
(should (eq tab-width 8))
(should (eq indent-tabs-mode nil)))
(editorconfig-mode -1))
+
+(ert-deftest test-lisp-use-default-indent nil
+ (editorconfig-mode 1)
+
+ (with-visit-file (concat editorconfig-secondary-ert-dir
+ "2_space.el")
+ (should (eq lisp-indent-offset 2)))
+
+ (let ((editorconfig-lisp-use-default-indent t))
+ (with-visit-file (concat editorconfig-secondary-ert-dir
+ "2_space.el")
+ (should (eq lisp-indent-offset nil))))
+
+ (let ((editorconfig-lisp-use-default-indent 2))
+ (with-visit-file (concat editorconfig-secondary-ert-dir
+ "2_space.el")
+ (should (eq lisp-indent-offset nil))))
+
+ (let ((editorconfig-lisp-use-default-indent 4))
+ (with-visit-file (concat editorconfig-secondary-ert-dir
+ "2_space.el")
+ (should (eq lisp-indent-offset 2))))
+ (editorconfig-mode -1))
diff --git a/ert-tests/test_files_secondary/.editorconfig
b/ert-tests/test_files_secondary/.editorconfig
new file mode 100644
index 0000000000..5ebe4a1bdd
--- /dev/null
+++ b/ert-tests/test_files_secondary/.editorconfig
@@ -0,0 +1,5 @@
+root = true
+
+[2_space.el]
+indent_size = 2
+indent_style = tab
diff --git a/ert-tests/test_files_secondary/2_space.el
b/ert-tests/test_files_secondary/2_space.el
new file mode 100644
index 0000000000..a566b8af2a
--- /dev/null
+++ b/ert-tests/test_files_secondary/2_space.el
@@ -0,0 +1 @@
+(print "hello world")