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

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

[nongnu] elpa/paredit c6300b9cbe 1/7: Batch up test failures and impleme


From: ELPA Syncer
Subject: [nongnu] elpa/paredit c6300b9cbe 1/7: Batch up test failures and implement expected-failure.
Date: Sat, 9 Jul 2022 04:59:07 -0400 (EDT)

branch: elpa/paredit
commit c6300b9cbe01570f6a64ef7b46dffd557ecddfd1
Author: Taylor R Campbell <campbell+paredit@mumble.net>
Commit: Taylor R Campbell <campbell+paredit@mumble.net>

    Batch up test failures and implement expected-failure.
---
 test.el | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/test.el b/test.el
index 1ddd551301..d37d92f8aa 100644
--- a/test.el
+++ b/test.el
@@ -19,9 +19,13 @@
 ;; You should have received a copy of the GNU General Public License
 ;; along with paredit.  If not, see <http://www.gnu.org/licenses/>.
 
+(defvar paredit-test-nfailures 0)
+(setq paredit-test-nfailures 0)
+
 (defun paredit-test-failure-default (command before after expected)
-  (error "%S failed test: after %S, got %S but expected %S."
-         command before after expected))
+  (setq paredit-test-nfailures (+ 1 paredit-test-nfailures))
+  (warn "%S failed test: after %S, got %S but expected %S."
+        command before after expected))
 
 (defvar paredit-test-failure-function 'paredit-test-failure-default
   "Function to call when `paredit-test' fails.
@@ -35,7 +39,10 @@ Four arguments: the paredit command, the text of the buffer
 (defun paredit-test (command examples)
   (message "Testing %S..." command)
   (dolist (example examples)
-    (let ((before (car example)))
+    (let* ((xfail
+            (and (eq (car example) 'xfail)
+                 (progn (setq example (cdr example)) t)))
+           (before (car example)))
       (dolist (expected (cdr example))
         (with-temp-buffer
           (paredit-test-buffer-setup)
@@ -56,7 +63,12 @@ Four arguments: the paredit command, the text of the buffer
                      (insert ?\|)
                      (not (string= expected (buffer-string))))
                     (t (error "Bad test expectation: %S" expected)))
-              (paredit-test-failed command before (buffer-string) expected)))
+              (if (not xfail)
+                  (let ((actual (buffer-string)))
+                    (paredit-test-failed command before actual expected)))
+            (if xfail
+                (let ((actual (buffer-string)))
+                  (paredit-test-failed command before actual 'failure)))))
         (setq before expected)))))
 
 (defun paredit-test-buffer-setup ()
@@ -1499,3 +1511,6 @@ Four arguments: the paredit command, the text of the 
buffer
        "\n(f xy\n   z\n   w)\n;;;T |"
        "\n(f xy\n   z\n   w)\n;;;|T "
        "\n(f xy\n   z\n   w)\n;;;|T "))))
+
+(if (> paredit-test-nfailures 0)
+    (error "%S paredit tests failed" paredit-test-nfailures))



reply via email to

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