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

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

[elpa] externals/compat 335ff37038 03/14: Restore test


From: ELPA Syncer
Subject: [elpa] externals/compat 335ff37038 03/14: Restore test
Date: Tue, 3 Jan 2023 20:57:28 -0500 (EST)

branch: externals/compat
commit 335ff37038b62cfd3b6a58b2ab2a03e0ac2fcdbd
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    Restore test
---
 compat-tests.el | 110 ++++++++++++++++++++++++++++----------------------------
 1 file changed, 54 insertions(+), 56 deletions(-)

diff --git a/compat-tests.el b/compat-tests.el
index 9767fe3d71..ab10324809 100644
--- a/compat-tests.el
+++ b/compat-tests.el
@@ -70,7 +70,60 @@
     (remhash 1 ht)
     (should (equal '(two) (hash-table-values ht)))))
 
-;; (defvar compat-test-counter)
+(ert-deftest compat-named-let ()
+  "Check if `named-let' was implemented properly."
+  (should (= (named-let l ((i 0)) (if (= i 8) i (l (1+ i))))
+             8))
+  (should (= (named-let l ((i 0)) (if (= i 100000) i (l (1+ i))))
+             100000))
+  (should (= (named-let l ((i 0))
+               (cond
+                ((= i 100000) i)
+                ((= (mod i 2) 0)
+                 (l (+ i 2)))
+                ((l (+ i 3)))))
+             100000))
+  (should (= (named-let l ((i 0) (x 1)) (if (= i 8) x (l (1+ i) (* x 2))))
+             (expt 2 8)))
+  (should (eq (named-let lop ((x 1))
+                (if (> x 0)
+                    (condition-case nil
+                        (lop (1- x))
+                      (arith-error 'ok))
+                  (/ 1 x)))
+              'ok))
+  (should (eq (named-let lop ((n 10000))
+                (if (> n 0)
+                    (condition-case nil
+                        (/ n 0)
+                      (arith-error (lop (1- n))))
+                  'ok))
+              'ok))
+  (should (eq (named-let lop ((x nil))
+                (cond (x)
+                      (t 'ok)))
+              'ok))
+  (should (eq (named-let lop ((x 100000))
+                (cond ((= x 0) 'ok)
+                      ((lop (1- x)))))
+              'ok))
+  (should (eq (named-let lop ((x 100000))
+                (cond
+                 ((= x -1) nil)
+                 ((= x 0) 'ok)
+                 ((lop -1))
+                 ((lop (1- x)))))
+              'ok))
+  (should (eq (named-let lop ((x 10000))
+                (cond ((= x 0) 'ok)
+                      ((and t (lop (1- x))))))
+              'ok))
+  (should (eq (let ((b t))
+                (named-let lop ((i 0))
+                  (cond ((null i) nil) ((= i 10000) 'ok)
+                        ((lop (and (setq b (not b)) (1+ i))))
+                        ((lop (and (setq b (not b)) (1+ i)))))))
+              'ok)))
 
 ;; (defun compat--ought (name compat)
 ;;   "Implementation for the `ought' macro for NAME.
@@ -1106,61 +1159,6 @@
 ;;   (ought "Prompt 10: " "Prompt %d" nil 10)
 ;;   (ought "Prompt \"abc\" (default 3): " "Prompt %S" 3 "abc"))
 
-;; (ert-deftest compat-named-let ()
-;;   "Check if `compat--t-named-let' was implemented properly."
-;;   (should (= (compat--t-named-let l ((i 0)) (if (= i 8) i (l (1+ i))))
-;;              8))
-;;   (should (= (compat--t-named-let l ((i 0)) (if (= i 100000) i (l (1+ i))))
-;;              100000))
-;;   (should (= (compat--t-named-let l ((i 0))
-;;                (cond
-;;                 ((= i 100000) i)
-;;                 ((= (mod i 2) 0)
-;;                  (l (+ i 2)))
-;;                 ((l (+ i 3)))))
-;;              100000))
-;;   (should (= (compat--t-named-let l ((i 0) (x 1)) (if (= i 8) x (l (1+ i) 
(* x 2))))
-;;              (expt 2 8)))
-;;   (should (eq (compat--t-named-let lop ((x 1))
-;;                 (if (> x 0)
-;;                     (condition-case nil
-;;                         (lop (1- x))
-;;                       (arith-error 'ok))
-;;                   (/ 1 x)))
-;;               'ok))
-;;   (should (eq (compat--t-named-let lop ((n 10000))
-;;                 (if (> n 0)
-;;                     (condition-case nil
-;;                         (/ n 0)
-;;                       (arith-error (lop (1- n))))
-;;                   'ok))
-;;               'ok))
-;;   (should (eq (compat--t-named-let lop ((x nil))
-;;                 (cond (x)
-;;                       (t 'ok)))
-;;               'ok))
-;;   (should (eq (compat--t-named-let lop ((x 100000))
-;;                 (cond ((= x 0) 'ok)
-;;                       ((lop (1- x)))))
-;;               'ok))
-;;   (should (eq (compat--t-named-let lop ((x 100000))
-;;                 (cond
-;;                  ((= x -1) nil)
-;;                  ((= x 0) 'ok)
-;;                  ((lop -1))
-;;                  ((lop (1- x)))))
-;;               'ok))
-;;   (should (eq (compat--t-named-let lop ((x 10000))
-;;                 (cond ((= x 0) 'ok)
-;;                       ((and t (lop (1- x))))))
-;;               'ok))
-;;   (should (eq (let ((b t))
-;;                 (compat--t-named-let lop ((i 0))
-;;                   (cond ((null i) nil) ((= i 10000) 'ok)
-;;                         ((lop (and (setq b (not b)) (1+ i))))
-;;                         ((lop (and (setq b (not b)) (1+ i)))))))
-;;               'ok)))
-
 ;; ;; TODO fix broken test
 ;; ;;(compat-deftests directory-files-recursively
 ;; ;;  (should (equal



reply via email to

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