branch: elpa/idris-mode
commit e342530a18d5cfa53e6c0b7fa8c6fd7ba2682cb0
Author: Marek <[email protected]>
Commit: Marek <[email protected]>

    Make sure running test idris-test-idris-start-project does not change 
window configuration
---
 test/idris-commands-test.el | 41 +++++++++++++++++++++--------------------
 1 file changed, 21 insertions(+), 20 deletions(-)

diff --git a/test/idris-commands-test.el b/test/idris-commands-test.el
index a23a77d217b..1e413a4cfba 100644
--- a/test/idris-commands-test.el
+++ b/test/idris-commands-test.el
@@ -287,26 +287,27 @@ myReverse xs = revAcc [] xs where
         (mock-first-module "TestModule")
         (mock-directory-name "test-start-project"))
     (unwind-protect
-        (cl-letf (((symbol-function 'read-string)
-                   (lambda (prompt &rest _)
-                     (cond ((string-prefix-p "Project name:" prompt)
-                            mock-project-name)
-                           ((string-prefix-p "Package file name" prompt)
-                            mock-package-file-name)
-                           ((string-prefix-p "Source directory" prompt)
-                            mock-source-directory)
-                           ((string-prefix-p "First module name" prompt)
-                            mock-first-module))))
-                  ((symbol-function 'read-directory-name)
-                   (lambda (&rest _) mock-directory-name)))
-          (idris-start-project)
-          (with-current-buffer mock-package-file-name
-            (goto-char (point-min))
-            (should (search-forward "package test-project"))
-            (should (search-forward "opts = \"\""))
-            (should (search-forward "sourcedir = \"src\""))
-            (should (search-forward "modules = TestModule"))
-            (kill-buffer)))
+        (save-window-excursion
+          (cl-letf (((symbol-function 'read-string)
+                     (lambda (prompt &rest _)
+                       (cond ((string-prefix-p "Project name:" prompt)
+                              mock-project-name)
+                             ((string-prefix-p "Package file name" prompt)
+                              mock-package-file-name)
+                             ((string-prefix-p "Source directory" prompt)
+                              mock-source-directory)
+                             ((string-prefix-p "First module name" prompt)
+                              mock-first-module))))
+                    ((symbol-function 'read-directory-name)
+                     (lambda (&rest _) mock-directory-name)))
+            (idris-start-project)
+            (with-current-buffer mock-package-file-name
+              (goto-char (point-min))
+              (should (search-forward "package test-project"))
+              (should (search-forward "opts = \"\""))
+              (should (search-forward "sourcedir = \"src\""))
+              (should (search-forward "modules = TestModule"))
+              (kill-buffer))))
       (if (get-buffer (concat mock-first-module ".idr"))
           (kill-buffer (concat mock-first-module ".idr")))
       (delete-directory mock-directory-name t)

Reply via email to