branch: elpa/dart-mode
commit d3d3d7e1ad0c524d967a6f8528bd883d2a7fdd45
Author: Brady Trainor <[email protected]>
Commit: Brady Trainor <[email protected]>
Add indentation tests
---
Makefile | 11 +++++++++--
test/{test.el => test-font-lock.el} | 0
test/test-indentation.el | 20 ++++++++++++++++++++
3 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 4e9a0ac..ac59e2b 100644
--- a/Makefile
+++ b/Makefile
@@ -9,8 +9,15 @@ package-lint: .cask
dart-mode.elc:
emacs -batch -f batch-byte-compile dart-mode.el
-test: .cask dart-mode.elc
- cask emacs -batch -l dart-mode.elc -l ert -l test/test.el -f
ert-run-tests-batch-and-exit
+test-setup: .cask dart-mode.elc
+
+test-font-lock: test-setup
+ cask emacs -batch -l dart-mode.elc -l ert -l test/test-font-lock.el -f
ert-run-tests-batch-and-exit
+
+test-indentation: test-setup
+ cask emacs -batch -l dart-mode.elc -l ert -l test/test-indentation.el
-f ert-run-tests-batch-and-exit
+
+test: test-font-lock test-indentation
checkdoc:
emacs -batch -eval "(when (>= emacs-major-version 25) (checkdoc-file
\"dart-mode.el\"))"
diff --git a/test/test.el b/test/test-font-lock.el
similarity index 100%
rename from test/test.el
rename to test/test-font-lock.el
diff --git a/test/test-indentation.el b/test/test-indentation.el
new file mode 100644
index 0000000..821aaaf
--- /dev/null
+++ b/test/test-indentation.el
@@ -0,0 +1,20 @@
+
+(defun dart-ert-test-indentation-of-file (file)
+ (with-temp-buffer
+ (insert-file-contents file)
+ (let ((orig-length (buffer-size)))
+ (dart-mode)
+ (let ((inhibit-message t))
+ (indent-region (point-min) (point-max)))
+ (= (buffer-size) orig-length))))
+
+(ert-deftest dart-indentation-test ()
+ (should (dart-ert-test-indentation-of-file
"test/faceup/language-samples/classes.dart"))
+ (should (dart-ert-test-indentation-of-file
"test/faceup/language-samples/comments.dart"))
+ (should (dart-ert-test-indentation-of-file
"test/faceup/language-samples/control-flow-statements.dart"))
+ (should (dart-ert-test-indentation-of-file
"test/faceup/language-samples/exceptions.dart"))
+ (should (dart-ert-test-indentation-of-file
"test/faceup/language-samples/functions.dart"))
+ (should (dart-ert-test-indentation-of-file
"test/faceup/language-samples/hello-world.dart"))
+ (should (dart-ert-test-indentation-of-file
"test/faceup/language-samples/imports.dart"))
+ (should (dart-ert-test-indentation-of-file
"test/faceup/language-samples/interfaces-and-abstract-classes.dart"))
+ (should (dart-ert-test-indentation-of-file
"test/faceup/language-samples/variables.dart")))