branch: elpa/nix-mode
commit 54ef83310095689443c2371a312cc8687af6cbb9
Merge: 01c53b7ff1 da16900326
Author: Matthew Bauer <[email protected]>
Commit: GitHub <[email protected]>
Merge pull request #68 from etu/fix-recent-regressions
Fix recent regressions
---
nix-mode.el | 3 +--
tests/nix-mode-tests.el | 16 +++++++++++++++-
tests/testcases/failed-ident-test.nix | 7 +++++++
3 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/nix-mode.el b/nix-mode.el
index 73d12a5e63..300f7de99e 100644
--- a/nix-mode.el
+++ b/nix-mode.el
@@ -117,7 +117,7 @@ Valid functions for this are:
(defconst nix-re-quotes "''\\|\"")
-(defconst nix-re-comments "#\\|/\\*\\|\\*/")
+(defconst nix-re-comments "#\\|/*\\|*/")
(defconst nix-font-lock-keywords
`((,(regexp-opt nix-keywords 'symbols) 0 'nix-keyword-face)
@@ -628,7 +628,6 @@ The hook `nix-mode-hook' is run when Nix mode is started.
;; Automatic indentation [C-j]
(setq-local indent-line-function nix-indent-function)
- (set (make-local-variable 'indent-region-function) 'nix-indent-region)
;; Indenting of comments
(setq-local comment-start "# ")
diff --git a/tests/nix-mode-tests.el b/tests/nix-mode-tests.el
index 7505908834..84c223ce76 100644
--- a/tests/nix-mode-tests.el
+++ b/tests/nix-mode-tests.el
@@ -70,7 +70,21 @@ function to do the indentation tests."
;; Run additional tests
,@body)))
-(ert-deftest nix-mode-indent-test-list-contents ()
+(ert-deftest nix-mode-test-indent-failed-ident ()
+ "Proper indentation for items inside of a list."
+ (with-nix-mode-test
+ ;; File to read
+ ("failed-ident-test.nix")
+
+ ;; Indent the buffer
+ (indent-region (point-min) (point-max))
+
+ ;; Compare buffer to the stored buffer contents
+ (should-not (equal
+ (buffer-substring-no-properties (point-min) (point-max))
+ raw-file))))
+
+(ert-deftest nix-mode-test-indent-list-contents ()
"Proper indentation for items inside of a list."
(with-nix-mode-test ("list-contents.nix" :indent t)))
diff --git a/tests/testcases/failed-ident-test.nix
b/tests/testcases/failed-ident-test.nix
new file mode 100644
index 0000000000..6d01f9d2c2
--- /dev/null
+++ b/tests/testcases/failed-ident-test.nix
@@ -0,0 +1,7 @@
+# This file is wrongly idented on purpose to have a failing test if the indent
+# doesn't run at all.
+[
+47
+"string"
+true
+]