emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/nix-mode ce8f523eb6 330/500: Set the indent function to th


From: ELPA Syncer
Subject: [nongnu] elpa/nix-mode ce8f523eb6 330/500: Set the indent function to the value passed in in with-nix-mode-test
Date: Sat, 29 Jan 2022 08:27:18 -0500 (EST)

branch: elpa/nix-mode
commit ce8f523eb6e119d20021baf12b6d51352c0db8b9
Author: Jakub Piecuch <j.piecuch96@gmail.com>
Commit: Jakub Piecuch <j.piecuch96@gmail.com>

    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))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]