branch: elpa/idris-mode commit ac9ebf015954f57e06c03e396f26ccaa07842ba0 Author: Marek L <nospam.ke...@gmail.com> Commit: Marek L <nospam.ke...@gmail.com>
Ensure that idris connection is closed in `idris-test-proof-search` Why: In Idris2 the test is expected to fail but unfortunately that also meant the Idris connection was not closed and leaked to other tests causing unexpected failures. --- idris-tests.el | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/idris-tests.el b/idris-tests.el index 2d79f4162c..2802c207f9 100644 --- a/idris-tests.el +++ b/idris-tests.el @@ -134,24 +134,25 @@ remain." :expected-result (if (string-match-p "idris2" idris-interpreter-path) :failed :passed) - (let ((buffer (find-file "test-data/ProofSearch.idr"))) - (with-current-buffer buffer - (idris-load-file) - (dotimes (_ 5) (accept-process-output nil 1)) - (goto-char (point-min)) - (re-search-forward "search_here") - (goto-char (match-beginning 0)) - (idris-proof-search) - (dotimes (_ 5) (accept-process-output nil 1)) - (should (looking-at-p "lteSucc (lteSucc (lteSucc (lteSucc (lteSucc lteZero))))")) - (move-beginning-of-line nil) - (delete-region (point) (line-end-position)) - (insert "prf = ?search_here") - (save-buffer) - (kill-buffer))) - - ;; More cleanup - (idris-quit)) + (unwind-protect + (let ((buffer (find-file "test-data/ProofSearch.idr"))) + (with-current-buffer buffer + (idris-load-file) + (dotimes (_ 5) (accept-process-output nil 1)) + (goto-char (point-min)) + (re-search-forward "search_here") + (goto-char (match-beginning 0)) + (idris-proof-search) + (dotimes (_ 5) (accept-process-output nil 1)) + (should (looking-at-p "lteSucc (lteSucc (lteSucc (lteSucc (lteSucc lteZero))))")) + (move-beginning-of-line nil) + (delete-region (point) (line-end-position)) + (insert "prf = ?search_here") + (save-buffer) + (kill-buffer))) + + ;; More cleanup + (idris-quit))) (ert-deftest idris-test-find-cmdline-args () "Test that idris-mode calculates command line arguments from .ipkg files."