branch: elpa/nix-mode
commit ce8f523eb6e119d20021baf12b6d51352c0db8b9
Author: Jakub Piecuch <[email protected]>
Commit: Jakub Piecuch <[email protected]>
Set the indent function to the value passed in in with-nix-mode-test
---
tests/nix-mode-tests.el | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/tests/nix-mode-tests.el b/tests/nix-mode-tests.el
index 2855357cb0..398390b795 100644
--- a/tests/nix-mode-tests.el
+++ b/tests/nix-mode-tests.el
@@ -39,8 +39,9 @@
(cl-defmacro with-nix-mode-test ((file &key indent) &rest body)
"Set up environment for testing `nix-mode'.
Execute BODY in a temporary buffer containing the contents of
-FILE, in `nix-mode'. All tests will use the `nix-indent-line'
-function to do the indentation tests."
+FILE, in `nix-mode'. INDENT should be the desired value of
+`nix-indent-function'. If it's non-nil, an indentation test
+will be run before executing BODY."
`(with-temp-buffer
;; Read test data file
@@ -48,21 +49,21 @@ function to do the indentation tests."
;; Store the file as a local variable and set the right indentation
function to use
(let ((raw-file (buffer-substring-no-properties (point-min) (point-max)))
- (nix-indent-function 'nix-indent-line)
+ (nix-indent-function
+ ,(or indent `',(default-value 'nix-indent-function)))
(inhibit-message t))
;; Load up nix-mode
(nix-mode)
;; If we're doing an indentation test
(when ,indent
- (let ((indent-line-function 'smie-indent-line))
- ;; Indent the buffer
- (indent-region (point-min) (point-max))
-
- ;; Compare buffer to the stored buffer contents
- (should (equal
- (buffer-substring-no-properties (point-min) (point-max))
- raw-file))))
+ ;; Indent the buffer
+ (indent-region (point-min) (point-max))
+
+ ;; Compare buffer to the stored buffer contents
+ (should (equal
+ (buffer-substring-no-properties (point-min) (point-max))
+ raw-file)))
;; Go to beginning
(goto-char (point-min))