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

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

[nongnu] elpa/idris-mode eb4b1fb530 2/6: Add extra iterations for proces


From: ELPA Syncer
Subject: [nongnu] elpa/idris-mode eb4b1fb530 2/6: Add extra iterations for processing in tests and
Date: Wed, 11 Jan 2023 10:03:39 -0500 (EST)

branch: elpa/idris-mode
commit eb4b1fb530ff048b6d7d42380aeaa5fe52f61549
Author: Marek L <nospam.keram@gmail.com>
Commit: Marek L <nospam.keram@gmail.com>

    Add extra iterations for processing in tests and
    
    cleanup in tests.
    (addreses feedback from emacs when trying
    byte-compile the test files)
    
    Why:
    To improve reliability of tests
---
 test/idris-commands-test.el | 19 ++++++++++---------
 test/idris-navigate-test.el | 13 ++++++++-----
 test/idris-test-utils.el    | 17 +++++++++--------
 test/idris-tests.el         |  3 ++-
 4 files changed, 29 insertions(+), 23 deletions(-)

diff --git a/test/idris-commands-test.el b/test/idris-commands-test.el
index b165bbf38f..179a7f16a5 100644
--- a/test/idris-commands-test.el
+++ b/test/idris-commands-test.el
@@ -37,7 +37,7 @@
     (should buffer)
     (with-current-buffer buffer
       (idris-run)
-      (dotimes (_ 5) (accept-process-output nil 0.1))
+      (dotimes (_ 10) (accept-process-output nil 0.1))
       (should idris-process)
       (should idris-connection))
     (idris-delete-ibc t)
@@ -48,7 +48,7 @@
   "Ensure that running Idris and quitting doesn't leave behind unwanted 
buffers."
   (let ((before (normalised-buffer-list)))
     (idris-repl)
-    (dotimes (_ 5) (accept-process-output nil 0.1))
+    (dotimes (_ 10) (accept-process-output nil 0.1))
     (idris-quit)
     (let* ((after (normalised-buffer-list))
            (extra (cl-set-difference after before)))
@@ -61,7 +61,7 @@ In particular, only *idris-events* should remain."
         (idris-log-events t))
 
     (idris-repl)
-    (dotimes (_ 5) (accept-process-output nil 0.1))
+    (dotimes (_ 10) (accept-process-output nil 0.1))
     (idris-quit)
     (let* ((after (normalised-buffer-list))
            (extra (cl-set-difference after before)))
@@ -79,7 +79,7 @@ In particular, only *idris-events* should remain."
       (idris-load-file)
 
       ;; Allow async stuff to happen
-      (dotimes (_ 5) (accept-process-output nil 0.1))
+      (dotimes (_ 10) (accept-process-output nil 0.1))
       (let ((mv-buffer (get-buffer idris-hole-list-buffer-name)))
         ;; The buffer exists and contains characters
         (should (bufferp mv-buffer))
@@ -100,7 +100,7 @@ In particular, only *idris-events* should remain."
         (idris-hole-show-on-load nil))
     (with-current-buffer buffer
       (idris-load-file))
-    (dotimes (_ 5) (accept-process-output nil 0.1))
+    (dotimes (_ 10) (accept-process-output nil 0.1))
     (let ((mv-buffer (get-buffer idris-hole-list-buffer-name)))
       (should-not (bufferp mv-buffer))
       (should (null mv-buffer)))
@@ -121,7 +121,7 @@ In particular, only *idris-events* should remain."
     ;; Test that hole info is present without need to load file manually
     (with-current-buffer buffer
       (idris-list-holes)
-      (dotimes (_ 5) (accept-process-output nil 0.1))
+      (dotimes (_ 10) (accept-process-output nil 0.1))
       (let ((holes-buffer (get-buffer idris-hole-list-buffer-name)))
         (should (bufferp holes-buffer))
         (should (> (buffer-size holes-buffer) 10)))
@@ -130,7 +130,7 @@ In particular, only *idris-events* should remain."
     ;; Test that the hole info is updated for the other current buffer
     (with-current-buffer other-buffer
       (idris-list-holes)
-      (dotimes (_ 5) (accept-process-output nil 0.1))
+      (dotimes (_ 10) (accept-process-output nil 0.1))
       (let ((holes-buffer (get-buffer idris-hole-list-buffer-name)))
         (should (not (bufferp holes-buffer))))
       (idris-delete-ibc t))
@@ -150,12 +150,12 @@ In particular, only *idris-events* should remain."
     (let ((buffer (find-file "test-data/ProofSearch.idr")))
       (with-current-buffer buffer
         (idris-load-file)
-        (dotimes (_ 5) (accept-process-output nil 0.1))
+        (dotimes (_ 10) (accept-process-output nil 0.1))
         (goto-char (point-min))
         (re-search-forward "search_here")
         (goto-char (match-beginning 0))
         (idris-proof-search)
-        (dotimes (_ 5) (accept-process-output nil 0.1))
+        (dotimes (_ 10) (accept-process-output nil 0.1))
         (should (looking-at-p "lteSucc (lteSucc (lteSucc (lteSucc (lteSucc 
lteZero))))"))
         (move-beginning-of-line nil)
         (delete-region (point) (line-end-position))
@@ -247,6 +247,7 @@ myReverse xs = revAcc [] xs where
     ;; Assert that we have clean global test state
     (should (not idris-connection))
     (with-current-buffer buffer
+      (switch-to-buffer buffer)
       (goto-char (point-min))
       (re-search-forward "data Test")
       (funcall-interactively 'idris-type-at-point nil)
diff --git a/test/idris-navigate-test.el b/test/idris-navigate-test.el
index e0b4e5b0e9..5e469d4a14 100644
--- a/test/idris-navigate-test.el
+++ b/test/idris-navigate-test.el
@@ -1,13 +1,13 @@
-(require 'idris-navigate)
+;;; idris-navigate-test.el --- Tests for idris-navigate
 
-;; Testing
-;; load-file-name is present in batch mode and buffer-file-name in interactive
-;; (add-to-list 'load-path
-;;              (file-name-directory (or load-file-name buffer-file-name)))
+(require 'idris-mode)
+(require 'idris-navigate)
 
 (require 'ert)
 (require 'idris-test-utils)
 
+;;; Code:
+
 (ert-deftest idris-backard-toplevel-navigation-test-2pTac9 ()
   "Test idris-backard-toplevel navigation command."
   (idris-test-with-temp-buffer
@@ -260,3 +260,6 @@ getData2 st failcount
    (idris-forward-statement)
    (should (looking-back "Store LoggedOut)]" (line-beginning-position)))
    ))
+
+(provide 'idris-navigate-test)
+;;; idris-navigate-test.el ends here
diff --git a/test/idris-test-utils.el b/test/idris-test-utils.el
index 27b099ab63..4c3d8fc19b 100644
--- a/test/idris-test-utils.el
+++ b/test/idris-test-utils.el
@@ -1,4 +1,4 @@
-;;; idris-tests.el --- Tests utilty for idris-mode  -*- lexical-binding: t -*-
+;;; idris-test-utils.el --- Tests utility for idris-mode  -*- lexical-binding: 
t -*-
 
 ;; Copyright (C) 2021 Yasuhiko Watanabe
 
@@ -20,11 +20,10 @@
 
 ;;; Commentary:
 
-;; This is a collection of simple tests for idris-mode.
+;; This is a collection of utilities used in tests for idris-mode.
 
 ;;; Code:
-(require 'cl-lib)
-(require 'idris-mode)
+(require 'subr-x)
 
 (defun idris-test-run-goto-char (test-fun &rest args)
   "To run commands like idris-case-split, we have to move the cursor to an 
appropriate location.
@@ -42,8 +41,10 @@ test  var = ?cases_rhs
   (progn
     (goto-char (point-min))
     (search-forward-regexp "^--.*\\+")
-    (goto-char (- (point) 1))
-    (next-line)
+    (goto-char (1- (point)))
+    (let ((col (current-column)))
+      (forward-line)
+      (move-to-column col))
     (apply test-fun args)
     ))
 
@@ -60,7 +61,7 @@ As this is not for a test of Idris itself, we do not care the 
results."
      (let ((buffer (find-file ,test-case)))
        (with-current-buffer buffer
          (idris-load-file)
-         (dotimes (_ 5) (accept-process-output nil 0.1)) ;;
+         (dotimes (_ 10) (accept-process-output nil 0.1)) ;;
          (idris-test-run-goto-char (function ,test-fun))
          (let ((this-buffer (current-buffer)))
            (should (,buffer-p buffer this-buffer))))
@@ -79,7 +80,7 @@ As this is not for a test of Idris itself, we do not care the 
results."
      (let ((buffer (find-file ,test-case)))
        (with-current-buffer buffer
          (idris-load-file)
-         (dotimes (_ 5) (accept-process-output nil 0.1)) ;;
+         (dotimes (_ 10) (accept-process-output nil 0.1)) ;;
          (idris-test-run-goto-char (function ,test-fun) nil)
          (let ((this-buffer (current-buffer)))
            (should (,buffer-p buffer this-buffer))))
diff --git a/test/idris-tests.el b/test/idris-tests.el
index 5b33b5ba6d..ce243e8c13 100644
--- a/test/idris-tests.el
+++ b/test/idris-tests.el
@@ -51,6 +51,7 @@
   (setq default-directory test-dir))
 
 (require 'ert)
+(require 'seq)
 
 (ert-deftest trivial-test ()
   (should t))
@@ -84,7 +85,7 @@
   (let ((buffer (find-file "test-data/TypeError.idr")))
     (with-current-buffer buffer
       (idris-load-file)
-      (dotimes (_ 5) (accept-process-output nil 0.1))
+      (dotimes (_ 10) (accept-process-output nil 0.1))
       (should (get-buffer idris-notes-buffer-name)))
     (with-current-buffer (get-buffer idris-notes-buffer-name)
       (goto-char (point-min))



reply via email to

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