branch: scratch/editorconfig-cc
commit 0d24b868d1e5b44fec2929f7d5a4b5eb32ca0542
Author: 10sr <8slashes+...@gmail.com>
Commit: Stefan Monnier <monn...@iro.umontreal.ca>

    Add more plugin tests
---
 ert-tests/editorconfig.el | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/ert-tests/editorconfig.el b/ert-tests/editorconfig.el
index e69de29bb2..11b7895c88 100644
--- a/ert-tests/editorconfig.el
+++ b/ert-tests/editorconfig.el
@@ -0,0 +1,27 @@
+(defmacro with-visit-file (path &rest body)
+  "Visit PATH and evaluate BODY."
+  (declare (indent 1) (debug t))
+  `(let ((buf (find-file-noselect ,path)))
+     (with-current-buffer buf
+       ,@body)
+     (kill-buffer buf)))
+
+(defvar editorconfig-ert-dir
+  (concat default-directory
+          "ert-tests/plugin-tests/test_files/"))
+
+(ert-deftest test-editorconfig nil
+  "Check if properties are applied."
+  (editorconfig-mode 1)
+
+  (with-visit-file (concat editorconfig-ert-dir
+                           "3_space.txt")
+    (should (eq tab-width 3))
+    (should (eq indent-tabs-mode nil)))
+
+  (with-visit-file (concat editorconfig-ert-dir
+                           "4_space.py")
+    (should (eq python-indent-offset 4))
+    (should (eq tab-width 8))
+    (should (eq indent-tabs-mode nil)))
+  (editorconfig-mode -1))

Reply via email to